forked from thelounge/thelounge
-
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.
Merge pull request thelounge#711 from thelounge/xpaw/bcrypt
Change bcrypt rounds from 8 to 11
- Loading branch information
Showing
5 changed files
with
73 additions
and
19 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
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
|
||
const expect = require("chai").expect; | ||
const Helper = require("../../src/helper"); | ||
|
||
describe("Client passwords", function() { | ||
const inputPassword = "my$Super@Cool Password"; | ||
|
||
it("hashed password should match", function() { | ||
// Generated with third party tool to test implementation | ||
let comparedPassword = Helper.password.compare(inputPassword, "$2a$11$zrPPcfZ091WNfs6QrRHtQeUitlgrJcecfZhxOFiQs0FWw7TN3Q1oS"); | ||
|
||
expect(comparedPassword).to.be.true; | ||
}); | ||
|
||
it("freshly hashed password should match", function() { | ||
let hashedPassword = Helper.password.hash(inputPassword); | ||
let comparedPassword = Helper.password.compare(inputPassword, hashedPassword); | ||
|
||
expect(comparedPassword).to.be.true; | ||
}); | ||
|
||
it("shout passwords should be marked as old", function() { | ||
expect(Helper.password.requiresUpdate("$2a$08$K4l.hteJcCP9D1G5PANzYuBGvdqhUSUDOLQLU.xeRxTbvtp01KINm")).to.be.true; | ||
expect(Helper.password.requiresUpdate("$2a$11$zrPPcfZ091WNfs6QrRHtQeUitlgrJcecfZhxOFiQs0FWw7TN3Q1oS")).to.be.false; | ||
}); | ||
}); |