mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Improve
This commit is contained in:
@@ -65,10 +65,14 @@ export class LoginPage implements OnInit {
|
||||
ngOnInit() {}
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateInput() {
|
||||
validateUsername() {
|
||||
return (
|
||||
this.username.trim().length > 0
|
||||
&& this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
validatePassword() {
|
||||
return (
|
||||
this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,34 +110,37 @@ export class LoginPage implements OnInit {
|
||||
|
||||
async Login() {
|
||||
|
||||
if (this.validateInput()) {
|
||||
this.userattempt = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
domainName: environment.domain,
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
if (await this.authService.login(this.userattempt)) {
|
||||
//this.loginRocketChat();
|
||||
this.authService.loginChat(this.userattempt);
|
||||
//this.getToken();
|
||||
|
||||
if(!this.pin) {
|
||||
this.setPint = true
|
||||
this.pin = true
|
||||
} else {
|
||||
this.router.navigate(['/home/events']);
|
||||
if (this.validateUsername()) {
|
||||
if(this.validatePassword()){
|
||||
this.userattempt = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
domainName: environment.domain,
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
if (await this.authService.login(this.userattempt)) {
|
||||
//this.loginRocketChat();
|
||||
this.authService.loginChat(this.userattempt);
|
||||
//this.getToken();
|
||||
|
||||
if(!this.pin) {
|
||||
this.setPint = true
|
||||
this.pin = true
|
||||
} else {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
this.toastService.badRequest('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar');
|
||||
}
|
||||
}
|
||||
else {
|
||||
//this.toastService.presentToast('Não foi possível fazer login"');
|
||||
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
|
||||
else{
|
||||
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
|
||||
}
|
||||
}
|
||||
else {
|
||||
//this.toastService.presentToast('Preencha todos campos');
|
||||
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
|
||||
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user