mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Add Pin
This commit is contained in:
@@ -13,10 +13,9 @@
|
||||
|
||||
<div class="terminal d-flex align-center justity-content-center flex-column">
|
||||
|
||||
<div (click)="login()">Login</div>
|
||||
|
||||
<div (click)="save()" class="pt-50 mt-50">Register</div>
|
||||
<div (click)="login()" class="dot">Login</div>
|
||||
|
||||
<div (click)="save()" class="pt-50 mt-50 dot">Register</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { BadRequestComponent } from '../popover/bad-request/bad-request.component';
|
||||
import { SuccessMessageComponent } from '../popover/success-message/success-message.component';
|
||||
import { FingerprintAIO } from '@ionic-native/fingerprint-aio';
|
||||
// import { FingerprintAIO } from '@ionic-native/fingerprint-aio';
|
||||
|
||||
@Component({
|
||||
selector: 'app-fingerprint',
|
||||
@@ -20,24 +20,26 @@ export class FingerprintPage implements OnInit {
|
||||
}
|
||||
|
||||
login() {
|
||||
// this.faio.show({
|
||||
// clientId: 'Fingerprint-Demo',
|
||||
// clientSecret: 'password', //Only necessary for Android
|
||||
// disableBackup:true, //Only for Android(optional)
|
||||
// localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
// localizedReason: 'Please authenticate' //Only for iOS
|
||||
// })
|
||||
// .then((FingerPrintHash: any) => {
|
||||
// console.log(FingerPrintHash)
|
||||
|
||||
// this.faio.show({
|
||||
// clientId: 'Fingerprint-Demo',
|
||||
// clientSecret: 'password', //Only necessary for Android
|
||||
// disableBackup:true, //Only for Android(optional)
|
||||
// localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
// localizedReason: 'Please authenticate' //Only for iOS
|
||||
// })
|
||||
// .then((FingerPrintHash: any) => {
|
||||
// console.log(FingerPrintHash)
|
||||
|
||||
// const storedFinderPrint = localStorage.getItem('FingerPrintHash')
|
||||
// if(FingerPrintHash == storedFinderPrint) {
|
||||
// const storedFinderPrint = localStorage.getItem('FingerPrintHash')
|
||||
// if(FingerPrintHash == storedFinderPrint) {
|
||||
|
||||
// }
|
||||
// })
|
||||
// .catch((error: any) => {
|
||||
// console.log(error)
|
||||
// });
|
||||
// }
|
||||
|
||||
// })
|
||||
// .catch((error: any) => {
|
||||
// console.log(error)
|
||||
// });
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -55,8 +57,10 @@ export class FingerprintPage implements OnInit {
|
||||
// localizedReason: 'Please authenticate' //Only for iOS
|
||||
// })
|
||||
// .then((FingerPrintHash: any) => {
|
||||
|
||||
// this.successMessage()
|
||||
// localStorage.setItem('FingerPrintHash', FingerPrintHash)
|
||||
|
||||
// })
|
||||
// .catch((error: any) => {
|
||||
// this.badRequest()
|
||||
|
||||
@@ -36,26 +36,11 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div (click)="clearCode()" class="d-flex align-center justify-center pt-25 clear">
|
||||
Limpar
|
||||
<div (click)="close()" class="d-flex align-center justify-center pt-25 clear">
|
||||
Voltar
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
|
||||
|
||||
<ion-footer class=" footer-container ion-no-border">
|
||||
<div class="d-flex justify-space-between">
|
||||
<ion-buttons slot="start" >
|
||||
<ion-button (click)="close()" class="btn-cancel" fill="clear" color="#061b52" >
|
||||
<ion-label>Cancelar</ion-label>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-buttons slot="end" >
|
||||
<ion-button (click)="save()" class="btn-ok" fill="clear" color="#fff" >
|
||||
<ion-label>Gravar</ion-label>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
|
||||
</ion-footer>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { BadRequestComponent } from '../popover/bad-request/bad-request.component';
|
||||
import { SuccessMessageComponent } from '../popover/success-message/success-message.component';
|
||||
|
||||
import crypto from 'crypto-js'
|
||||
@Component({
|
||||
selector: 'app-pin',
|
||||
templateUrl: './pin.page.html',
|
||||
@@ -19,8 +19,10 @@ export class PinPage implements OnInit {
|
||||
setCode(code: string) {
|
||||
if(this.code.length < 4) {
|
||||
this.code.push(code)
|
||||
} else {
|
||||
this.clearCode()
|
||||
}
|
||||
|
||||
if(this.code.length == 4) {
|
||||
this.save()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,11 +36,16 @@ export class PinPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async save() {
|
||||
async save() {
|
||||
if(this.code.length == 4) {
|
||||
|
||||
this.successMessage()
|
||||
localStorage.setItem('PIN', this.code.join(''))
|
||||
|
||||
const code = this.code.join('')
|
||||
const encrypted = crypto.SHA1(code)
|
||||
|
||||
localStorage.setItem('PIN', encrypted)
|
||||
|
||||
} else {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user