Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Support entityPasswordField override of passwordField
Browse files Browse the repository at this point in the history
  • Loading branch information
adamvr committed May 23, 2017
1 parent 8f451a4 commit 1d33673
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/verifier.js
Expand Up @@ -21,11 +21,14 @@ class LocalVerifier {
}

_comparePassword(entity, password) {
// select entity password field - take entityPasswordField over passwordField
const passwordField = this.options.entityPasswordField || this.options.passwordField;

// find password in entity, this allows for dot notation
const hash = get(entity, this.options.passwordField);
const hash = get(entity, passwordField);

if (!hash) {
return Promise.reject(new Error(`'${this.options.entity}' record in the database is missing a '${this.options.passwordField}'`));
return Promise.reject(new Error(`'${this.options.entity}' record in the database is missing a '${passwordField}'`));
}

debug('Verifying password');
Expand Down

0 comments on commit 1d33673

Please sign in to comment.