-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix passsword expiration check for google login accounts
- Loading branch information
Showing
4 changed files
with
7 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,26 +367,6 @@ describe("checkPasswordExpiration middleware", () => { | |
expect(next).to.not.have.been.called; | ||
}); | ||
|
||
it("should set header if the password is expiring soon", async () => { | ||
const minutesToExpire = 9; | ||
sinon.stub(Users, "findByPk").resolves({ | ||
passwordUpdatedAt: new Date( | ||
Date.now() - 1000 * 60 * (PASSWORD_EXPIRATION_MINUTES - minutesToExpire) | ||
), | ||
email: "[email protected]", | ||
}); | ||
|
||
await checkPasswordExpiration(req, res, next); | ||
|
||
expect(res.setHeader).to.have.been.calledWith( | ||
"Password-Expiry-Notification", | ||
sinon.match( | ||
/Your password will expire in \d+ minutes. Please update your password./ | ||
) | ||
); | ||
expect(next).to.have.been.calledOnce; | ||
}); | ||
|
||
it("should call next if the password is valid", async () => { | ||
sinon.stub(Users, "findByPk").resolves({ | ||
passwordUpdatedAt: new Date(Date.now() - 1000 * 60 * 5), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters