def commit_history(self, date): """ Sets all events before the specified date to be committed. """ result = db.update('journal', committed=1, where="date<=$date&&user_id=$self.user_id", vars=locals()) return result
def update_recovery_status(cls, token, invalid=1): """ Updates password recovery ticket, assuming successful recovery. Returns true if one row affected, else false. """ if db.update('pwrecovery', where="token=$token", invalid=invalid, vars=locals()) == 1: return True else: return False
def update_password(cls, user_id, password): """ Updates password according to specified user_id and new password. Returns true if updated for one user or password unchanged, false otherwise. """ user_list = cls.select_users(user_id=user_id) password_hash = hash_utils.hash_password(password) if len(user_list) == 1 and password_hash == user_list[0].password: return True if db.update('users', where="user_id=$user_id", password=password_hash, vars=locals()) \ == 1: return True return False
def commit_history(cls, user_id, date): result = db.update('journal', committed=1, where="date<$date&&user_id=$user_id", vars=locals()) return result