db based login and auto login with registration