|     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit a415c08b authored by Emi Simpson's avatar Emi Simpson
Browse files

[api] Print a warning when a password hash is too long

parent 3032ef02
Pipeline #1057 passed with stage
in 46 seconds
......@@ -119,10 +119,13 @@ class SetPassword(NamedTuple):
def get_query(self) -> QueryRequest:
hashed = password_hasher.hash(self.password)
if len(hashed) > 97:
print(f'[WARN] Password hash length longer than expected: {hashed}')
return QueryRequest('''
INSERT INTO passwords
VALUES (%s, %s);
''', (self.user, password_hasher.hash(self.password)))
''', (self.user, hashed))
def handle_results(self, results: QueryResult | SqlIntegrityError) -> Finished[None] | Error[None]:
if isinstance(results, SqlIntegrityError):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment