This commit is contained in:
tiago.kayaya
2021-06-01 13:18:41 +01:00
3 changed files with 34 additions and 11 deletions
+3 -1
View File
@@ -26,7 +26,9 @@
</div>
</div>
<ion-title class="title">Digite o PIN novo</ion-title>
<ion-title *ngIf="!setPint" class="title">Digite o PIN</ion-title>
<ion-title *ngIf="setPint" class="title">Digite o novo PIN</ion-title>
<div class="d-flex pt-25 align-center justify-center">
<div class="dot" [class.dot-active]="code.length >= 1"></div>
<div class="dot" [class.dot-active]="code.length >= 2"></div>
+1 -1
View File
@@ -126,7 +126,7 @@ ion-content{
-o-border-radius: 50px;
}
.main-content{
.main-content {
background-color: white;
text-align: center;
align-items: center;
+30 -9
View File
@@ -33,6 +33,7 @@ export class LoginPage implements OnInit {
password: string = environment.defaultuserpwd;
userattempt: UserForm;
code = []
setPint = false
pin = localStorage.getItem('PIN') != null
@@ -47,11 +48,9 @@ export class LoginPage implements OnInit {
public alertController: AlertController,
private modalController: ModalController
//private fcm: FCM
) { }
) { }
ngOnInit() {
}
ngOnInit() {}
//Function to validade the login inputs
validateInput() {
@@ -94,9 +93,7 @@ export class LoginPage implements OnInit {
}
async Login() {
/* try { */
//Go to our home in home/feed.
//this.router.navigate(['/home/events']);
if (this.validateInput()) {
this.userattempt = {
username: this.username,
@@ -108,7 +105,13 @@ export class LoginPage implements OnInit {
this.loginRocketChat();
//this.getToken();
this.router.navigate(['/home/events']);
if(!this.pin) {
this.setPint = true
this.pin = true
} else {
this.router.navigate(['/home/events']);
}
}
else {
//this.toastService.presentToast('Não foi possível fazer login"');
@@ -127,7 +130,15 @@ export class LoginPage implements OnInit {
}
if(this.code.length == 4) {
this.pinLogin()
const code = this.code.join('')
const encrypted = crypto.SHA1(code)
if(this.setPint) {
this.storePin()
} else {
this.pinLogin()
}
}
}
@@ -151,6 +162,16 @@ export class LoginPage implements OnInit {
}
storePin() {
const code = this.code.join('')
const encrypted = crypto.SHA1(code)
localStorage.setItem('PIN', encrypted)
this.router.navigate(['/home/events']);
}
async successMessage(message?: string) {
const modal = await this.modalController.create({