/**
* @file Page for Login component
*/
-import { isNullOrUndefined } from 'util';
import { HttpErrorResponse } from '@angular/common/http';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { RestService } from 'RestService';
import { Observable } from 'rxjs';
-import { SharedService } from 'SharedService';
+import { SharedService, isNullOrUndefined } from 'SharedService';
import { UserDetail } from 'UserModel';
/**
/** contains the passwordIn observable value @public */
public changePassword: boolean;
+ /** To show the visiblity of password @public */
+ public visiblePassword: boolean;
+
/** Utilizes auth service for any auth operations @private */
private authService: AuthenticationService;
}
}
+ /** To Show or Hide the Password @public */
+ public onShowPassword(): void {
+ this.visiblePassword = !this.visiblePassword;
+ }
+
/** To display password expiry Toaster with required data @public */
public passwordExpiryToaster(): void {
if ((this.accountNoOfDays === '1' && this.passwordNoOfDays === '1') ||
this.sharedService.passwordToaster(this.lastLogin, this.failedAttempts, this.passwordNoOfDays,
this.passwordExpireMessage, this.passwordMessage);
} else {
- if (this.accountNoOfDays === '1') {
- this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRETOMORROW');
- this.accountMessage = '';
- this.accountNoOfDays = '';
- } else if (this.accountNoOfDays === '0') {
- this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRETODAY');
- this.accountMessage = '';
- this.accountNoOfDays = '';
- } else {
- this.accountExpireMessage = this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRE');
- this.accountMessage = this.translateService.instant('PAGE.LOGIN.DAYS');
- }
- this.sharedService.showToaster(this.lastLogin, this.failedAttempts, this.passwordNoOfDays, this.accountNoOfDays,
- this.passwordExpireMessage, this.accountExpireMessage, this.passwordMessage, this.accountMessage);
+ this.accountDaysCheck();
}
}
}
}
+ /** To check account no.of days with 0 & 1 @public */
+ public accountDaysCheck(): void {
+ if (this.accountNoOfDays === '1') {
+ this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRETOMORROW');
+ this.accountMessage = '';
+ this.accountNoOfDays = '';
+ } else if (this.accountNoOfDays === '0') {
+ this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRETODAY');
+ this.accountMessage = '';
+ this.accountNoOfDays = '';
+ } else {
+ this.accountExpireMessage = this.accountExpireMessage = this.translateService.instant('PAGE.LOGIN.ACCOUNTEXPIRE');
+ this.accountMessage = this.translateService.instant('PAGE.LOGIN.DAYS');
+ }
+ this.sharedService.showToaster(this.lastLogin, this.failedAttempts, this.passwordNoOfDays, this.accountNoOfDays,
+ this.passwordExpireMessage, this.accountExpireMessage, this.passwordMessage, this.accountMessage);
+ }
/** To display account expiry Toaster with required data @public */
public accountExpiryToaster(): void {
if (!isNullOrUndefined(this.accountNoOfDays)) {
this.sharedService.accountToaster(this.lastLogin, this.failedAttempts,
this.accountNoOfDays, this.accountExpireMessage, this.accountMessage);
} else {
- if (this.passwordNoOfDays === '1') {
- this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRETOMORROW');
- this.passwordMessage = '';
- this.passwordNoOfDays = '';
- } else if (this.passwordNoOfDays === '0') {
- this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRETODAY');
- this.passwordMessage = '';
- this.passwordNoOfDays = '';
- } else {
- this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRE');
- this.passwordMessage = this.translateService.instant('PAGE.LOGIN.DAYS');
- }
- this.sharedService.showToaster(this.lastLogin, this.failedAttempts, this.passwordNoOfDays, this.accountNoOfDays,
- this.passwordExpireMessage, this.accountExpireMessage, this.passwordMessage, this.accountMessage);
+ this.passwordDaysCheck();
}
}
}
}
+ /** To check password no.of days with 0 & 1 @public */
+ public passwordDaysCheck(): void {
+ if (this.passwordNoOfDays === '1') {
+ this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRETOMORROW');
+ this.passwordMessage = '';
+ this.passwordNoOfDays = '';
+ } else if (this.passwordNoOfDays === '0') {
+ this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRETODAY');
+ this.passwordMessage = '';
+ this.passwordNoOfDays = '';
+ } else {
+ this.passwordExpireMessage = this.translateService.instant('PAGE.LOGIN.PASSWORDEXPIRE');
+ this.passwordMessage = this.translateService.instant('PAGE.LOGIN.DAYS');
+ }
+ this.sharedService.showToaster(this.lastLogin, this.failedAttempts, this.passwordNoOfDays, this.accountNoOfDays,
+ this.passwordExpireMessage, this.accountExpireMessage, this.passwordMessage, this.accountMessage);
+ }
/** To display password & account expiry Toaster with required data @public */
public showToaster(): void {
if (!isNullOrUndefined(this.accountNoOfDays) && !isNullOrUndefined(this.passwordNoOfDays)) {