Skip to content

Commit

Permalink
Document callback arguments to methods.authenticate()
Browse files Browse the repository at this point in the history
  • Loading branch information
Talon committed Jan 15, 2015
1 parent f30226d commit d0bf05a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Expand Up @@ -124,8 +124,20 @@ For a complete example implementing a registration, login and logout see the

## API Documentation
### Instance methods
* setPassword(password, cb) asynchronous method to set a user's password hash and salt
* authenticate(password, cb) asynchronous method to authenticate a user instance

#### setPassword(password, cb)
asynchronous method to set a user's password hash and salt

#### authenticate(password, cb)
asynchronous method to authenticate a user instance

**callback arguments**
- err
- null unless the hasing algorithm throws an error
- thisModel
- the model getting authenticated *if* authentication was successful otherwise false
- passwordErr
- the reason the password failed, else undefined ex. `{message: "Incorrect password"}

Using `setPassword()` will only update the document's password fields, but will not save the document.
To commit the changed document, remember to use Mongoose's `document.save()` after using `setPassword()`.
Expand Down

0 comments on commit d0bf05a

Please sign in to comment.