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


TypeScript accounts-base.Accounts類代碼示例

本文整理匯總了TypeScript中meteor/accounts-base.Accounts的典型用法代碼示例。如果您正苦於以下問題:TypeScript Accounts類的具體用法?TypeScript Accounts怎麽用?TypeScript Accounts使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Accounts類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

export default function(context: IContext) {
  const { Session } = context;

  // configure accounts
  console.log("Configuring accounts ...");

  delete Accounts["_accountsCallbacks"]["reset-password"];
  Accounts.onResetPasswordLink((token: string, done: Function) => {
    Session.set(VIEWKEY, "resetPassword");
    Session.set(TOKENKEY, token);
  });

  delete Accounts["_accountsCallbacks"]["verify-email"];
  Accounts.onEmailVerificationLink((token: string, done: Function) => {
    Accounts.verifyEmail(token, function(err: any) {
      if (err != null) {
        if (err.message = "Verify email link expired [403]") {
          Session.set(ERRORKEY, __("accounts.error.loginTokenExpired"));
        }
      } else {
        Session.set(MESSAGEKEY, __("accounts.messages.emailVerified"));
        done();
      }
    });
  });

}
開發者ID:tomitrescak,項目名稱:meteor-accountsui-semanticui-react,代碼行數:27,代碼來源:accounts_config.ts

示例2: addTestUser

function addTestUser(username:string, email:string, role:string) {
  let existsUser:any = Accounts.findUserByEmail(email) ? true : false;
  if (existsUser) {
    Meteor.users.remove({_id: existsUser._id});
  }
  const password = "1234";
  log.info("Created Username:" + username + ", email: " + email +", password:" + password + ", role:" + role );
  var user = Accounts.createUser({username: username, email: email, password: password});
  Roles.addUsersToRoles(user, [role]);
}
開發者ID:kokokenada,項目名稱:for-real-cards,代碼行數:10,代碼來源:user.model.ts

示例3:

Meteor.startup(() => {
  if (Meteor.settings) {
    Object.assign(Accounts._options, Meteor.settings['accounts-phone']);
    SMS.twilio = Meteor.settings['twilio'];
  }

  if (Users.collection.find().count() > 0) {
    return;
  }

  Accounts.createUserWithPhone({
    phone: '+972540000001',
    profile: {
      name: 'Ethan Gonzalez',
      picture: 'https://randomuser.me/api/portraits/men/1.jpg'
    }
  });

  Accounts.createUserWithPhone({
    phone: '+972540000002',
    profile: {
      name: 'Bryan Wallace',
      picture: 'https://randomuser.me/api/portraits/lego/1.jpg'
    }
  });

  Accounts.createUserWithPhone({
    phone: '+972540000003',
    profile: {
      name: 'Avery Stewart',
      picture: 'https://randomuser.me/api/portraits/women/1.jpg'
    }
  });

  Accounts.createUserWithPhone({
    phone: '+972540000004',
    profile: {
      name: 'Katie Peterson',
      picture: 'https://randomuser.me/api/portraits/women/2.jpg'
    }
  });

  Accounts.createUserWithPhone({
    phone: '+972540000005',
    profile: {
      name: 'Ray Edwards',
      picture: 'https://randomuser.me/api/portraits/men/2.jpg'
    }
  });
});
開發者ID:ShinFDuran,項目名稱:Pruebas,代碼行數:50,代碼來源:main.ts

示例4:

Meteor.startup(function () {

  if (Meteor.users.find().fetch().length === 0) 
  {
    var users = [
        {name:"Test1",email:"test1@example.com",roles:[]},
        {name:"Test2",email:"test2@example.com",roles:[]},
        {name:"Test3",email:"test3@example.com",roles:[]},
        {name:"Admin",email:"admin@example.com",roles:['admin']}
      ];

	for (var i = 0; i < users.length; i++) 
	{      
      console.log(users[i]);
      var id = Accounts.createUser({
        email: users[i].email,
        password: "password",
        profile: { name: users[i].name }
      });
      // email verification
      Meteor.users.update({_id: id}, {$set:{'emails.0.verified': true}});
      Roles.addUsersToRoles(id, users[i].roles); 
    }
  }

});
開發者ID:Feldor,項目名稱:society,代碼行數:26,代碼來源:main.ts

示例5: signup

 signup(credentials, username, password, repeatPassword, email) 
 {
   if (this.signupForm.valid) 
   {
     if(password === repeatPassword) 
     {
       Accounts.createUser({username: username, email: email, password: password}, (err) => {
       if (err) 
       {
         this.error = err;
       }
       else 
       {
         Meteor.loginWithPassword(email, password, (err) => {
           if (err) 
           {
             this.error = err;
           }
           else 
           {
             this.router.navigate(['/']);
           }
           });
         }
       });
     }
     else
       this.error = "Las contraseĂąas no coinciden";
   }
 }
開發者ID:Feldor,項目名稱:society,代碼行數:30,代碼來源:singup.ts

示例6:

Meteor.startup(() => {
    ShopItems.find().count();

    Accounts.config({
        forbidClientAccountCreation: true
    });
});
開發者ID:yk,項目名稱:damgr,代碼行數:7,代碼來源:main.ts

示例7: reject

    return new Promise<void>((resolve, reject) => {
      Accounts.verifyPhone(phoneNumber, code, (e: Error) => {
        if (e) {
          return reject(e);
        }

        resolve();
      });
    });
開發者ID:ShinFDuran,項目名稱:Pruebas,代碼行數:9,代碼來源:phone.ts

示例8: reset

 reset() {
   Accounts.forgotPassword(this.credentials, this.$bindToContext((err) => {
     if (err) {
       this.error = err;
     } else {
       this.$state.go('parties');
     }
   }));
 }
開發者ID:AyushAnandChouksey,項目名稱:meteor-angular-socially,代碼行數:9,代碼來源:password.ts

示例9: registerUser

 //Testing purposes
 registerUser(){
   Accounts.createUser({
     'username':this.username,
     'password':this.password,
     'profile':{
       'firstname':this.firstname,
       'lastname':this.lastname
     }
   });
 }
開發者ID:gab3alm,項目名稱:csun_nsls,代碼行數:11,代碼來源:login.component.ts


注:本文中的meteor/accounts-base.Accounts類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。