當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript bcrypt-nodejs.compare函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。