This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
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 #308 from Jeddf/profile-hashes
Profile password hashes
- Loading branch information
Showing
5 changed files
with
58 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const bcrypt = require('bcryptjs'); | ||
const saltRounds = process.env.NODE_ENV == 'test' ? 5 : 12; | ||
|
||
const encodePassword = async input => { | ||
const salt = await bcrypt.genSalt(saltRounds); | ||
|
||
return await bcrypt.hash(input, salt); | ||
}; | ||
|
||
module.exports = { encodePassword }; |
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,9 @@ | ||
DO $$ | ||
BEGIN | ||
BEGIN | ||
ALTER TABLE sys_user ADD COLUMN profile_password character varying; | ||
EXCEPTION | ||
WHEN duplicate_column THEN RAISE NOTICE 'column profile_password already exists in sys_user.'; | ||
END; | ||
END; | ||
$$ |
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 |
---|---|---|
|
@@ -479,6 +479,11 @@ bcrypt-pbkdf@^1.0.0: | |
dependencies: | ||
tweetnacl "^0.14.3" | ||
|
||
[email protected]: | ||
version "2.4.3" | ||
resolved "https://registry.yarnpkg.com/bcryptjs/-/bcryptjs-2.4.3.tgz#9ab5627b93e60621ff7cdac5da9733027df1d0cb" | ||
integrity sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms= | ||
|
||
[email protected]: | ||
version "0.3.1" | ||
resolved "https://registry.yarnpkg.com/big-number/-/big-number-0.3.1.tgz#ac73020c0a59bb79eb17c2ce2db77f77d974e013" | ||
|