def log_in_with_email(self, email, password): # log the user in using their email if EnkiModelBackoffTimer.get(email, True) == 0: user = EnkiModelUser.get_by_email(email) if user and user.password: validPassword = enki.authcryptcontext.pwd_context.verify( password, user.password) if validPassword: self.log_in_session_token_create(user) EnkiModelBackoffTimer.remove(user.email) return True return False
def reauthenticate(self, email, password): # reauthenticate the user if EnkiModelBackoffTimer.get(email, True) == 0: user = EnkiModelUser.get_by_email(email) if user and user.password: validPassword = enki.authcryptcontext.pwd_context.verify( password, user.password) if validPassword and self.is_logged_in( ) and self.user_id == user.key.id(): self.session['reauth_time'] = datetime.datetime.now() EnkiModelBackoffTimer.remove(user.email) return True return False