fix: accounts confirmed more than a day ago also bring their orders
Some checks failed
Some checks failed
The signups that marked an account as confirmed are deleted after a day, so an older account was left unconfirmed and brought nothing. The code e-mail sent before the account existed stays in the queue and now counts too. A password reset, whose link came by e-mail, also confirms the address and brings the orders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,11 +91,15 @@ def recovery(tag):
|
||||
with db.connect() as c:
|
||||
# Only the token's hash is kept.
|
||||
assert not c.execute('SELECT 1 FROM dtf_local.password_resets WHERE token_hash=%s', (token,)).fetchone()
|
||||
# An account never confirmed: the reset link, sent to the address, confirms it.
|
||||
c.execute('UPDATE dtf_local.accounts SET email_verified=false WHERE email=%s', (address,))
|
||||
|
||||
stranger.call('/account/reset', {'token': 'x' * 43, 'password': NEW_PASSWORD}, expected=400)
|
||||
stranger.call('/account/reset', {'token': token, 'password': 'curta'}, expected=422)
|
||||
assert stranger.call('/account/reset', {'token': token, 'password': NEW_PASSWORD})['customer']['mail'] == address
|
||||
assert stranger.call('/account/me')['customer']['mail'] == address
|
||||
with db.connect() as c:
|
||||
assert c.execute('SELECT email_verified FROM dtf_local.accounts WHERE email=%s', (address,)).fetchone()['email_verified']
|
||||
# Works once; the old password and the old sessions are gone.
|
||||
stranger.call('/account/reset', {'token': token, 'password': NEW_PASSWORD}, expected=400)
|
||||
elsewhere.call('/account/me', expected=401)
|
||||
|
||||
Reference in New Issue
Block a user