def djLogin(username, password): dj_key = getDjKey(username=username) dj = getDj(dj_key) if dj is not None: if check_password(dj.password_hash, password): return dj return None
def djLogin(username, password): d = Dj.all().filter("username =", username).get() if d is not None: if check_password(d.password_hash, password): return d else: return None else: return None
def recovery_login(cls, username, reset_key): dj = cls.get_by_username(username) if dj is None: raise NoSuchUsername() if (dj.pw_reset_expire is None or dj.pw_reset_hash is None or datetime.datetime.now() > dj.pw_reset_expire): raise InvalidLogin() elif check_password(dj.pw_reset_hash, reset_key): dj.pw_reset_expire = datetime.datetime.now() dj.reset_hash = None dj.put() return dj
def password_matches(self, password): return check_password(self.password, password)