allow auto login from actual login page and some related code refactorin...

...g