My previous post was somewhat off. Actually, what happens is that if the form passes validation, but has incorrect login credentials, auth.login() will trigger a redirect with the following code:
redirect(self.url(args=request.args, vars=request.get_vars), client_side=settings.client_side) Upon redirect, the form.vars are lost, and thus the form is no pre-populated with the previously typed in value. This redirect does not occur if the form does not pass validation (such as having an invalid email), and thus the returned form still has form.vars If the login credentials are incorrect, the returned form should have all the previously typed in values (except for the password for security reasons), so the user can see where they made the error. If you return a blank form, the user must guess what they typed in the username/email input, which is needlessly frustrating. On Monday, September 15, 2014 1:42:10 PM UTC-7, Mark Li wrote: > > After submitting a failed login attempt with auth.login(), the failed > username input is not returned (it is cleared out). This is not a problem > when auth.define_tables(username=False), which would return the failed > email input upon login error. But, when username=True, the form no longer > returns the failed input after a login error. This would be an important > issue for users, because they don't see their failed credentials that they > previously typed (excluding the password). > > I added a print request.function to the model, and after a failed login > attempt (with auth.define_tables(username=True)), there is a double > redirect, which seemed to cause problems previously as well: > https://groups.google.com/forum/#!searchin/web2py/auth.login$20return$20username/web2py/9omfJYNoOC8/RrLOgeXENvMJ > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.