def POST(self): i = web.input() f = forms.forgot_password() if not f.validates(i): return render.forgot_password(f) else: from infogami.infobase.client import ClientException try: delegate.admin_login() d = web.ctx.site.get_reset_code(i.email) except ClientException, e: f.note = str(e) web.ctx.headers = [] return render.forgot_password(f) else:
def POST(self): i = web.input() f = forms.forgot_password() if not f.validates(i): return render.forgot_password(f) else: from infogami.infobase.client import ClientException try: delegate.admin_login() d = web.ctx.site.get_reset_code(i.email) except ClientException as e: f.note = str(e) web.ctx.headers = [] return render.forgot_password(f) else: # clear the cookie set by delegate.admin_login # Otherwise user will be able to work as admin user. web.ctx.headers = [] msg = render.password_mailer(web.ctx.home, d.username, d.code) web.sendmail(config.from_address, i.email, msg.subject.strip(), str(msg)) return render.passwordsent(i.email)
def GET(self): f = forms.forgot_password() return render.forgot_password(f)