mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
add inactivity page
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="main-wrapper">
|
||||
|
||||
|
||||
<div class="wrapper" *ngIf="SessionStore.user.LoginPreference == 'Password' ">
|
||||
<div class="wrapper" *ngIf="SessionStore.user.LoginPreference == 'Password' && SessionStore.hasPin || SessionStore.user.LoginPreference == null && SessionStore.hasPin ">
|
||||
|
||||
<div class="bg-1 d-flex justify-center align-center">
|
||||
<div class="bg-2 d-flex justify-center align-center">
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content d-flex flex-column height-100 width" *ngIf="!SessionStore.hasPin || SessionStore.hasPin" >
|
||||
<div class="main-content d-flex flex-column height-100 width" *ngIf="!SessionStore.hasPin || SessionStore.hasPin && SessionStore.user.LoginPreference == 'Pin' " >
|
||||
|
||||
<div class="div-top-header">
|
||||
|
||||
|
||||
@@ -17,13 +17,17 @@ ion-content{
|
||||
background: white !important;
|
||||
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
width: 400px;
|
||||
/* width: 400px; */
|
||||
height: auto;
|
||||
padding: 0 !important;
|
||||
margin: auto !important;
|
||||
/* margin: auto !important; */
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
|
||||
}
|
||||
|
||||
.logo{
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
|
||||
@@ -45,6 +45,58 @@ export class InactivityPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateUsername() {
|
||||
return (
|
||||
this.username.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
validatePassword() {
|
||||
return (
|
||||
this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
async Login() {
|
||||
|
||||
if (this.validateUsername()) {
|
||||
if(this.validatePassword()) {
|
||||
|
||||
this.userattempt = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
domainName: environment.domain,
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
let attempt = await this.authService.login(this.userattempt, false)
|
||||
|
||||
if (attempt) {
|
||||
|
||||
// if current attemp is equal to the current user
|
||||
if (attempt.UserId == SessionStore.user.UserId) {
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
await this.authService.loginChat(this.userattempt);
|
||||
await this.getToken();
|
||||
|
||||
this.router.navigate(['/home/events']);
|
||||
} else {
|
||||
SessionStore.delete()
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
|
||||
}
|
||||
}
|
||||
|
||||
getToken() {
|
||||
this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user