Exemplo n.º 1
0
 def recover_password(self):
     if not c.user.recovery_key:
         c.user.gen_recovery_key()
     email_password_reset(c.user)
     meta.Session.commit()
     h.flash(_('Password recovery email sent to %(user_email)s. '
               'Please check your inbox.') % {
               'user_email': c.user.email.email
               })
     redirect(url(controller='profile', action='login_settings'))
Exemplo n.º 2
0
    def pswrecovery(self):
        if hasattr(self, 'form_result'):
            email = self.form_result.get('email', None)
            # TODO: this needs to be resolved, get_global is wrong here:
            user = User.get_global(email)
            if user is not None:
                if not user.recovery_key:
                    user.gen_recovery_key()
                email_password_reset(user)
                meta.Session.commit()
                h.flash(_('Password recovery email sent. Please check your inbox.'))
            else:
                h.flash(_('User account not found.'))

        return htmlfill.render(self._pswrecovery_form())