def forgot_password(self, email): if not getattr(config, "allow_password_reset", False): return sent, error = userdb.send_forgot_password(email) if error is None: if sent: self.logger.info("Sent password reset email to %s.", email) else: self.logger.info("User requested a password reset, but email " "is not registered (%s).", email) self.send_message("forgot_password_done") else: self.logger.info("Failed to send password reset email for %s: %s", email, error) self.send_message("forgot_password_fail", reason = error)