Beispiel #1
0
Meteor.startup(function () {

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

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

});
Beispiel #2
0
 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";
   }
 }
Beispiel #3
0
 //Testing purposes
 registerUser(){
   Accounts.createUser({
     'username':this.username,
     'password':this.password,
     'profile':{
       'firstname':this.firstname,
       'lastname':this.lastname
     }
   });
 }
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 = "******";
  log.info("Created Username:"******", email: " + email +", password:"******", role:" + role );
  var user = Accounts.createUser({username: username, email: email, password: password});
  Roles.addUsersToRoles(user, [role]);
}
 register() {
   Accounts.createUser(this.credentials,
     this.$bindToContext((err) => {
       if (err) {
         this.error = err;
       } else {
         this.$state.go('parties');
       }
     })
   );
 }
 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']);
       }
     });
   }
 }
Beispiel #7
0
  signup():void {
    this.resetErrors();

    Accounts.createUser(this.credentials, (error) => {
      if (error) {
        this.errors.push(error.reason || "Unknown error");
      }
      else {
        this.isDropdownOpen = false;
        this._resetCredentialsFields();
      }
    });
  }
 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('');
   }
 }
 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(['/']);
       }
     });
   }
 }
Beispiel #10
0
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: '******',
      email: '*****@*****.**',
      password: adminPassword,
      profile: {
        name: 'Admin',
      },
    });
    Roles.addUsersToRoles(id, ['admin'], Roles.GLOBAL_GROUP);
  }
});