mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
save
This commit is contained in:
@@ -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