Skip to content

Commit

Permalink
setPassword also removes the link - previous "fixes" were unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad.r committed Jun 3, 2024
1 parent e697292 commit c132c16
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/core/authentication-flows-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ export class AuthenticationFlowsProcessor {
throw new LinkExpiredError(`ERROR: user ${username} tried to use non-existing link`);
}

//this part was persisted in the DB, in order to make sure the activation-link is single-used.
//so here we remove it from the DB:
await this.removeLinkFromDB( username );

const tokenDate: Date = new Date(tokenData.date);

//check if link is expired:
Expand All @@ -467,6 +463,7 @@ export class AuthenticationFlowsProcessor {
//encrypt the password:
const encodedPassword: string = shaString(password);

//store the new password, and also clear the link, to ensure the activation-link is single-used:
debug("setting password for user " + username);
await this._authenticationAccountRepository.setPassword(username, encodedPassword);
}
Expand Down

0 comments on commit c132c16

Please sign in to comment.