mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
FingerPrint fixe
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-fingerprint',
|
||||
templateUrl: './fingerprint.page.html',
|
||||
styleUrls: ['./fingerprint.page.scss'],
|
||||
})
|
||||
export class FingerprintPage implements OnInit {
|
||||
|
||||
constructor( private modalController: ModalController,
|
||||
private faio: FingerprintAIO) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
const storedFinderPrint = localStorage.getItem('FingerPrintHash')
|
||||
if(FingerPrintHash == storedFinderPrint) {
|
||||
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.log(error)
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
/* console.log(this.isEventEdited); */
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
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) => {
|
||||
this.successMessage()
|
||||
localStorage.setItem('FingerPrintHash', FingerPrintHash)
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.badRequest()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
|
||||
this.close()
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest(message?: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo não efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user