refactoring of framework javascript, login and logout functions working