0.21.8 • Published 4 years ago

mongoose-bcryptr v0.21.8

Weekly downloads
12
License
-
Repository
-
Last release
4 years ago

mongoose-bcryptr

Hash a password on a mongoose model.

Installation

npm install --save mongoose-bcryptr

Usage

let mongoose = require('mongoose');
let plugin = require('mongoose-bcryptr');
let UserSchema = new mongoose.Schema({
  password:  String
});

UserSchema.plugin(plugin);

const User = mongoose.model('User', UserSchema);
let user = new User();

// modify & save password
user.password = 'xxx';
user.save();

// verify password
user.verify('xxx'));

Options

  • verifyFn(password) - A function to verify the password. Must return true if valid.
0.21.8

4 years ago

0.21.7

4 years ago

0.21.6

4 years ago

0.21.5

4 years ago

0.21.4

4 years ago

0.21.1

5 years ago