mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 18:04:18 +00:00
fix(auth): retire password reset links when the account's email or password changes
A reset link is a credential sent to the address the account had when it was asked for. It stayed valid for its full hour after the account moved to another address or got a new password, so a link sent to the old mailbox could still set a password on the account. Changing the email in the user's own settings, changing the password, and an admin changing a user's email or setting a password now consume every live reset link of that user, in the same transaction as the change. Saving the same address, or it in another case, keeps the link, and a link asked for afterwards works as before.
This commit is contained in:
@@ -17,6 +17,7 @@ import { resetTestDb } from '../../helpers/test-db';
|
||||
import {
|
||||
createTestUnitOfWork,
|
||||
createTestAppSettingsRepo,
|
||||
createTestPasswordResetTokensRepo,
|
||||
createTestUsersRepo,
|
||||
sharedTestOrm,
|
||||
} from '../../helpers/test-uow';
|
||||
@@ -69,6 +70,7 @@ beforeAll(async () => {
|
||||
await createTestUnitOfWork(testDb),
|
||||
await createTestAppSettingsRepo(testDb),
|
||||
await createTestUsersRepo(testDb),
|
||||
await createTestPasswordResetTokensRepo(testDb),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user