本文整理汇总了TypeScript中bcrypt-nodejs.compare函数的典型用法代码示例。如果您正苦于以下问题:TypeScript compare函数的具体用法?TypeScript compare怎么用?TypeScript compare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compare函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
PlatformSchema.methods.comparePassword = function(candidatePassword: string, callback: Function): void {
bcrypt
.compare(candidatePassword, this.password, (err, isMatch: boolean) => {
if (err) { return callback(err) }
callback(null, isMatch)
})
}
开发者ID:yeegr,项目名称:SingularJS,代码行数:7,代码来源:PlatformModel.ts
示例2: it
it('Testing hash compare', function(done) {
bcrypt.compare(thePassword, theHash, (err, res) => {
expect(err).to.equal(null);
expect(res).to.equal(true);
done();
});
});
开发者ID:GeekAthelon,项目名称:SoiWidgets,代码行数:7,代码来源:bcrypt-nodejs-mocha.ts
示例3: resolve
return await new Promise<boolean>((resolve, reject) => {
bcrypt.compare(password, encrypted, (err: Error, result: boolean) => {
if (err) {
resolve(false);
}
resolve(result);
});
});
开发者ID:nicholas-robson,项目名称:dkydev_webapp,代码行数:8,代码来源:user.ts
示例4: function
userSchema.methods.comparePassword = function(inputPassword, callback) {
bcrypt.compare(inputPassword, this.password, (err, result)=>{
if(err){
return callback(err);
}
callback(null, result);
});
};
开发者ID:BartoszSiemienczuk,项目名称:teamsuite,代码行数:8,代码来源:user.ts
示例5: Promise
return new Promise((resolve, reject) => {
bcrypt.compare(user.receivedPass, user.password, function (err, res) {
if (err || !res) reject();
else {
delete user['receivedPass'];
resolve(user)
}
});
})
开发者ID:andreyZavrazhnov,项目名称:angular2-edge-app,代码行数:9,代码来源:commonHelpers.ts
示例6: resolve
return new Promise<boolean>((resolve, reject) => {
bcrypt.compare(password, hash, (err, res) => {
/* istanbul ignore if */
if (err) {
console.log('There was an error in password-hash-bcrypt');
console.log(err);
resolve(false);
}
resolve(res);
});
});
开发者ID:GeekAthelon,项目名称:SoiWidgets,代码行数:11,代码来源:password-hash-bcrypt.ts
示例7: ComparePassword
ComparePassword(password: string, callback: (match: boolean) => void): void {
if (!password) {
throw new Error("password doesn't contain value");
}
bcript.compare(password, this.Password, (error: Error, result: boolean): void => {
if (error) {
Log.c("User", "ComparePassword", error);
throw error;
}
callback(result);
});
}
开发者ID:pteyssedre,项目名称:lazy-uac,代码行数:12,代码来源:models.ts
示例8: function
const comparePassword: comparePasswordFunction = function (candidatePassword, cb) {
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error, isMatch: boolean) => {
cb(err, isMatch);
});
};
开发者ID:omnajjar,项目名称:node-express-app-starter,代码行数:5,代码来源:User.ts
示例9: function
userSchema.methods.comparePassword = function (candidatePassword: string, cb: (err: any, isMatch: any) => {}) {
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error, isMatch: boolean) => {
cb(err, isMatch);
});
};
开发者ID:babula38,项目名称:TypeScript-Node-Starter,代码行数:5,代码来源:User.ts
示例10: resolve
var promise = new Promise<boolean>((resolve, reject) => {
bcrypt.compare(unhashed, hashedString, (err, isCorrect: boolean) => {
if (err) return reject("[COMPARE] " + err);
resolve(Promise.resolve(isCorrect));
});
});
开发者ID:Seikho,项目名称:auth-api,代码行数:6,代码来源:compareHash.ts
注:本文中的bcrypt-nodejs.compare函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论