yes. as you requested. :-) On Monday, 8 June 2015 17:31:22 UTC-5, James McGlynn wrote: > > Thank you for the quick action (I can't believe I found a bug!), > > One more question: > > Will reset_password also use > > reset_password_onaccept and > reset_password_onvalidation? > > > On Sunday, June 7, 2015 at 10:29:05 PM UTC-4, Massimo Di Pierro wrote: >> >> It is a bug. I just fixed it in trunk. Now request_reset_password uses >> >> request_reset_password_onaccept >> request_reset_password_onvalidation >> >> On Sunday, 7 June 2015 19:46:33 UTC-5, James McGlynn wrote: >>> >>> Hello, >>> >>> I have a few questions about using callbacks with reset_password and >>> request_reset_password. I'm using web2py 2.9.5, but I checked the >>> corresponding code from the master branch and github in gluon/tools.py and >>> it seems to be the same. >>> >>> Why does the callback auth.settings.reset_password_onaccept get called >>> when auth.request_reset_password() is accepted, instead of when >>> auth.reset_password() is accepted (request_reset vs reset)? >>> >>> Why does the function reset_password in gluon/tools.py not have a >>> callback at all( that is, why doesn't it have the line "callback(onaccept, >>> form)")? Would it be dangerous to do so? >>> >>> I wanted a callback after the auth.reset_password() form was submitted >>> so I changed the reset_password function to include these lines: >>> >>> def reset_password( >>> ..... >>> ..... >>> >>> if next is DEFAULT: >>> next = self.get_vars_next() or >>> self.settings.reset_password_next >>> >>> >>> ######################################################################## >>> ## Added by me (taken from the request_reset_function) >>> if onvalidation is DEFAULT: >>> onvalidation = self.settings.reset_password_onvalidation >>> if onaccept is DEFAULT: >>> onaccept = self.settings.reset_password_onaccept >>> >>> ######################################################################## >>> >>> ...... >>> ...... >>> >>> if self.settings.login_after_password_change: >>> self.login_user(user) >>> >>> >>> ###################################################################### >>> ## Added by me (also taken from the request_reset_password >>> function) >>> callback(onaccept, form) >>> >>> ###################################################################### >>> >>> >>> redirect(next, client_side=self.settings.client_side) >>> return form >>> >>> >>> Is this ok to do? It seems to do what I want, which was to remove a role >>> from a user after password reset. >>> >>> Thank you. >>> >>
-- 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.