loginProcess(u) {

    let username: string = u.username;
    let password: string = u.password;

    Meteor.loginWithPassword(username, password, (error) => {
      if (typeof error !== 'undefined') {
        this.swalService.swal('Warning', error.reason, 'error');
      } else {
        var user = Meteor.users.findOne(Meteor.userId());

        Meteor.users.update(
          {
            _id: user._id
          }, {
            $set: {
              profile: {
                name: user.profile.name,
                status: 'online'
              }
            }
          }
        );

        this.swalService.swal('Info', 'anda berhasil login', 'success');
        window.location.href = '/post';
      }
    });

  }
Beispiel #2
0
 verifyLogin(username:string, password:string){
   Meteor.loginWithPassword(username, password, (err)=>{
     if(!err){
       this.router.navigate(['admin']);
       Session.set('USERNAME',username);
     }
   });  
 }
 login(credentials) {
   if (this.loginForm.valid) {
     Meteor.loginWithPassword(this.loginForm.value.email, this.loginForm.value.password, (err) => {
       if (err) {
         this.error = err;
       } else {
         this.router.navigate(['/']);
       }
     });
   }
 }
 login() {
   Meteor.loginWithPassword(this.credentials.email, this.credentials.password,
     this.$bindToContext((err) => {
       if (err) {
         this.error = err;
       } else {
         this.$state.go('parties');
       }
     })
   );
 }
Beispiel #5
0
	// Meteor Method - API 
	// (http://docs.meteor.com/api/accounts.html#Meteor-loginWithPassword)
	public validateLogin(username:string, password:string){
		Meteor.loginWithPassword(username, password, err=>{
			if(!err){
				Session.set('USERNAME',username);
				Users.update({"_id":Meteor.userId()}, {$set: {
					'profile.presence':1
				}});
				this.router.navigate(['home']);
			}
		});
	}
	login(credentials) {
    if (this.loginForm.valid) {
      Meteor.loginWithPassword(credentials.email, credentials.password, (err) => {
        if (err) {
          this.error = err;
          console.log("Login Failed");
          document.getElementById("errorMessage").innerHTML = "Invalid Input";
        }
        else {
          console.log("Login Successful");
          this.router.navigate(['/DeckList']);
        }
      });
    }
  }
Beispiel #7
0
  login():void {
    this.resetErrors();

    let email:string = this.credentials.email;
    let password:string = this.credentials.password;

    Meteor.loginWithPassword(email, password, (error) => {
      if (error) {
        this.errors.push(error.reason || "Unknown error");
      }
      else {
        this.isDropdownOpen = false;
        this._resetCredentialsFields();
      }
    });
  }
Beispiel #8
0
 login(credentials, username, password) 
 {
   if (this.loginForm.valid) 
   {
     Meteor.loginWithPassword(username, password, (err) => {
         if (err) 
         {
           this.error = err;
         }
         else 
         {
           this.router.navigate(['/']);
         }
     });
   }
 }
Beispiel #9
0
 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(['/']);
     }
     });
   }
 });
Beispiel #10
0
  login(credentials) {
    if (this.loginForm.valid) {
      Meteor.loginWithPassword(credentials.email, credentials.password, (err) => {
        if (err) {
          this.error = err;
        }
        else {



          //     var loggedInUser = Meteor.user();

          // if (Roles.userIsInRole(loggedInUser, ['caller'], 'default-group')) {
          //              this.router.navigate(['/HomeView']);
          // }
          // if (Roles.userIsInRole(loggedInUser, ['player'], 'default-group')) {
          //           this.router.navigate(['/HomeView']);
          // }

          this.router.navigate(['/homeView']);
        }
      });
    }
  }