def set_password(self, new_password): """Set a user's password.""" self.hashedpw = rnc_crypto.hash_password(new_password, BCRYPT_DEFAULT_LOG_ROUNDS) self.last_password_change_utc = pls.NOW_UTC_NO_TZ self.must_change_password = False
def take_some_time_mimicking_password_encryption(): """Waste some time. We use this when an attempt has been made to log in with a nonexistent user; we know the user doesn't exist very quickly, but we mimic the time it takes to check a real user's password.""" rnc_crypto.hash_password("dummy!", BCRYPT_DEFAULT_LOG_ROUNDS)