Skip to content

Commit

Permalink
Increase default cost to 12 from 10
Browse files Browse the repository at this point in the history
  • Loading branch information
venables committed Feb 13, 2017
1 parent a786667 commit abf529c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/secure-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = function (Bookshelf) {
'use strict'
const bcrypt = require('bcrypt')
const DEFAULT_PASSWORD_FIELD = 'password_digest'
const DEFAULT_SALT_ROUNDS = 12
const PasswordMismatchError = require('./error')
const proto = Bookshelf.Model.prototype

Expand All @@ -28,7 +29,7 @@ module.exports = function (Bookshelf) {
this.virtuals.password = {
get: function () {},
set: function (value) {
let salt = bcrypt.genSaltSync(10)
let salt = bcrypt.genSaltSync(DEFAULT_SALT_ROUNDS)
let passwordDigest = bcrypt.hashSync(value, salt)
this.set(passwordDigestField, passwordDigest)
}
Expand Down

0 comments on commit abf529c

Please sign in to comment.