当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Accounts.createUser方法代码示例

本文整理汇总了TypeScript中meteor/accounts-base.Accounts.createUser方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Accounts.createUser方法的具体用法?TypeScript Accounts.createUser怎么用?TypeScript Accounts.createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meteor/accounts-base.Accounts的用法示例。


在下文中一共展示了Accounts.createUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

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

示例2: 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

示例3: 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

示例4: 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

示例5: register

 register() {
   Accounts.createUser(this.credentials,
     this.$bindToContext((err) => {
       if (err) {
         this.error = err;
       } else {
         this.$state.go('parties');
       }
     })
   );
 }
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:11,代码来源:register.ts

示例6: signup

 signup(credentials) {
   if (this.signupForm.valid) {
     Accounts.createUser({ email: credentials.email, password: credentials.password}, (err) => {
       if (err) {
         this.error = err;
       }
       else {
         this.router.navigate(['/PartiesList']);
       }
     });
   }
 }
开发者ID:RichardHwang886,项目名称:meteor-angular2.0-socially,代码行数:12,代码来源:signup.ts

示例7: signup

  signup():void {
    this.resetErrors();

    Accounts.createUser(this.credentials, (error) => {
      if (error) {
        this.errors.push(error.reason || "Unknown error");
      }
      else {
        this.isDropdownOpen = false;
        this._resetCredentialsFields();
      }
    });
  }
开发者ID:Anhmike,项目名称:angular2-shop,代码行数:13,代码来源:login-buttons.ts

示例8: register

 register(user) {
   if (this.registerForm.valid) {
       Accounts.createUser({
           email: user.email,
           password: user.password,
           profile: {
             name: user.name
           }
       });
       (this.registerForm.controls['email']).updateValue('');
       (this.registerForm.controls['password']).updateValue('');
       (this.registerForm.controls['name']).updateValue('');
   }
 }
开发者ID:albertvazquezm,项目名称:present,代码行数:14,代码来源:register-form.ts

示例9: signup

 signup() {
   if (this.signupForm.valid) {
     Accounts.createUser({
       email: this.signupForm.value.email,
       password: this.signupForm.value.password
     }, (err) => {
       if (err) {
         this.error = err;
       } else {
         this.router.navigate(['/']);
       }
     });
   }
 }
开发者ID:Tallyb,项目名称:meteor-angular2.0-socially,代码行数:14,代码来源:signup.component.ts

示例10:

Meteor.startup(() => {
  // Create an admin user if one does not exist.
  if (Meteor.users.find().count() === 0) {
    const bTesting = true;
    const adminPassword = (bTesting) ? 'test' : 'ch3wbawkan3s3!';
    // Admin account.
    const id = Accounts.createUser({
      username: 'admin',
      email: 'andrew.page32@gmail.com',
      password: adminPassword,
      profile: {
        name: 'Admin',
      },
    });
    Roles.addUsersToRoles(id, ['admin'], Roles.GLOBAL_GROUP);
  }
});
开发者ID:andyp22,项目名称:my_resume,代码行数:17,代码来源:admin.ts


注:本文中的meteor/accounts-base.Accounts.createUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。