mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
save
This commit is contained in:
@@ -16,17 +16,17 @@
|
||||
</div>
|
||||
<h3 class="center text-white">Inicie a sessão</h3>
|
||||
<form class="form">
|
||||
<p class="form-label text-white">Nome de utilizador</p>
|
||||
<p class="form-label text-white">Email</p>
|
||||
<ion-item class="form-input">
|
||||
<ion-input type="text" [(ngModel)]="username" name="input-username"></ion-input>
|
||||
</ion-item>
|
||||
<p class="form-label text-white">Palavra-passe</p>
|
||||
<ion-item class="form-input">
|
||||
<ion-input (keyup.enter)="Login()" type="password" [(ngModel)]="password" name="input-password" ></ion-input>
|
||||
</ion-item>
|
||||
</ion-item>
|
||||
<div class="d-flex pt-25">
|
||||
<button class="btn-ok btn-login" fill="clear" expand="block" shape="round" (click)="Login()">Iniciar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="msg-bottom d-flex">
|
||||
<p class="msg-bottom-p">Uma iniciativa do Gabinete do Presidente da República</p>
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="div-logo">
|
||||
<img src='assets/images/logo-bg.png' alt='logo'>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<ion-title *ngIf="hasPin" class="title">Digite o PIN</ion-title>
|
||||
<ion-title *ngIf="!hasPin" class="title">Digite o novo PIN</ion-title>
|
||||
@@ -52,25 +52,25 @@
|
||||
<div class="dot"[class.dot-active]="code.length >= 4"></div>
|
||||
</div>
|
||||
<div class="terminal">
|
||||
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="circle" (click)="setCode('1')">1</div> <div class="circle" (click)="setCode('2')">2</div> <div class="circle" (click)="setCode('3')">3</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="circle" (click)="setCode('4')">4</div> <div class="circle" (click)="setCode('5')">5</div> <div class="circle" (click)="setCode('6')">6</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="circle" (click)="setCode('7')">7</div> <div class="circle" (click)="setCode('8')">8</div> <div class="circle" (click)="setCode('9')">9</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex align-center justify-center">
|
||||
<div class="circle" (click)="setCode('0')">0</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="hasPin" class="voltar d-flex align-center justify-center pt-25 clear" (click)="loginPreference = 'none'">
|
||||
Entrar com senha
|
||||
</div>
|
||||
@@ -81,8 +81,8 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</ion-content>
|
||||
</ion-content>
|
||||
|
||||
@@ -34,7 +34,7 @@ export class LoginPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
public alertController: AlertController,
|
||||
private localstoreService: LocalstoreService
|
||||
) {
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -49,13 +49,13 @@ export class LoginPage implements OnInit {
|
||||
// this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
let userData = this.localstoreService.get('UserData', {})
|
||||
|
||||
let userData = this.localstoreService.get('UserData', {})
|
||||
|
||||
const loginPreference = userData?.loginPreference
|
||||
const pin = userData?.PIN
|
||||
|
||||
if (pin) {
|
||||
this.hasPin = true
|
||||
this.hasPin = true
|
||||
} else {
|
||||
this.hasPin = false
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export class LoginPage implements OnInit {
|
||||
this.username.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
validatePassword() {
|
||||
return (
|
||||
this.password.trim().length > 0
|
||||
@@ -125,7 +125,7 @@ export class LoginPage implements OnInit {
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
let attempt = await this.authService.login(this.userattempt);
|
||||
|
||||
|
||||
if (attempt) {
|
||||
this.authService.loginChat(this.userattempt);
|
||||
this.getToken();
|
||||
@@ -139,7 +139,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService.badRequest('O nome de utilizador e/ou palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar');
|
||||
this.toastService.badRequest('O email e/ou palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar');
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -152,16 +152,16 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
setCode(code: string) {
|
||||
|
||||
|
||||
if(this.code.length < 4) {
|
||||
this.code.push(code)
|
||||
}
|
||||
|
||||
if(this.code.length == 4) {
|
||||
|
||||
|
||||
const code = this.code.join('')
|
||||
const encrypted = crypto.SHA1(code)
|
||||
|
||||
|
||||
if(!this.hasPin) {
|
||||
// alert('storePin')
|
||||
this.storePin()
|
||||
@@ -177,15 +177,15 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
pinLogin() {
|
||||
|
||||
|
||||
const code = this.code.join('')
|
||||
const encrypted = crypto.SHA1(code)
|
||||
|
||||
|
||||
let userData = this.localstoreService.get('UserData', {})
|
||||
const pin = userData?.PIN
|
||||
|
||||
//if( encrypted == pin) {
|
||||
|
||||
|
||||
if( encrypted == this.localstoreService.get('UserData', false)) {
|
||||
|
||||
//this.toastService.successMessage()
|
||||
@@ -201,19 +201,19 @@ export class LoginPage implements OnInit {
|
||||
|
||||
const code = this.code.join('')
|
||||
const encrypted = crypto.SHA1(code)
|
||||
let userData: Object = this.localstoreService.get('UserData', {})
|
||||
let userData: Object = this.localstoreService.get('UserData', {})
|
||||
|
||||
userData['PIN'] = encrypted
|
||||
userData['loginPreference'] = 'none'
|
||||
|
||||
|
||||
this.localstoreService.set('UserData', userData)
|
||||
|
||||
this.localstoreService.set('UserData', userData)
|
||||
|
||||
|
||||
this.localstoreService.set('PIN', encrypted)
|
||||
this.localstoreService.set('PIN', encrypted)
|
||||
|
||||
this.router.navigate(['/home/events']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user