Skip to content

Commit

Permalink
Move password setting to a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
venables committed Feb 13, 2017
1 parent 93b22e4 commit da3c19f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/secure-password.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = function (Bookshelf) {
'use strict'
const bcrypt = require('bcrypt')
const DEFAULT_PASSWORD_FIELD = 'password_digest'
const DEFAULT_PASSWORD_FIELD = 'password'
const DEFAULT_PASSWORD_DIGEST_FIELD = 'password_digest'
const DEFAULT_SALT_ROUNDS = 12
const PasswordMismatchError = require('./error')
const proto = Bookshelf.Model.prototype
Expand All @@ -21,7 +22,7 @@ module.exports = function (Bookshelf) {
return model.hasSecurePassword
}

return DEFAULT_PASSWORD_FIELD
return DEFAULT_PASSWORD_DIGEST_FIELD
}

/**
Expand Down Expand Up @@ -60,7 +61,7 @@ module.exports = function (Bookshelf) {
passwordDigestField = passwordField(this)

this.virtuals = this.virtuals || {}
this.virtuals.password = {
this.virtuals[DEFAULT_PASSWORD_FIELD] = {
get: function getPassword () {},
set: function setPassword (value) {
if (value === null) {
Expand Down

0 comments on commit da3c19f

Please sign in to comment.