login issues fixes : ps

This commit is contained in:
VE10-Sanjeev 2022-08-18 17:13:02 +05:30
parent 03f66f5914
commit e49427941a
5 changed files with 82 additions and 76 deletions

View File

@ -40,8 +40,8 @@ import { AuthLayoutComponent } from './layouts/auth/auth-layout.component';
import { SharedModule } from './shared/shared.module'; import { SharedModule } from './shared/shared.module';
import { AwsService } from './AwsService/aws.service'; import { AwsService } from './AwsService/aws.service';
import { TokenInterceptor } from './_guard/token.interceptor'; import { TokenInterceptor } from './_guard/token.interceptor';
// import { NewPasswordDialog, ForgotPass } from './session/login/login.component'; import { NewPasswordDialog, ForgotPass } from './session/login/login.component';
import { NewPasswordDialog,ForgotPass } from './session/otp/otp.component'; import { NewPasswordDialog2,ForgotPass2 } from './session/otp/otp.component';
import { AuthGuard } from './_guard/auth.guard'; import { AuthGuard } from './_guard/auth.guard';
import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe'; import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe';
import { ResizableModule } from 'angular-resizable-element'; import { ResizableModule } from 'angular-resizable-element';
@ -77,7 +77,8 @@ export function createTranslateLoader(http: HttpClient) {
AppComponent, AppComponent,
AdminLayoutComponent, AdminLayoutComponent,
AuthLayoutComponent, AuthLayoutComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, NewPasswordDialog,ForgotPass,
NewPasswordDialog2,ForgotPass2,ChangePasswordDialog, RoleMenuItemsPipe,
HttpLoaderComponent, HttpLoaderComponent,
OtpComponent, OtpComponent,
// AdvanceFilterComponent, // AdvanceFilterComponent,
@ -138,7 +139,7 @@ export function createTranslateLoader(http: HttpClient) {
}, },
{ provide:MAT_DATE_LOCALE, useValue: 'en-GB' } { provide:MAT_DATE_LOCALE, useValue: 'en-GB' }
], ],
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog,OtpComponent], entryComponents: [NewPasswordDialog,ForgotPass,NewPasswordDialog2,ForgotPass2,ChangePasswordDialog,OtpComponent],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

View File

@ -102,7 +102,8 @@ export class LoginComponent implements OnInit{
this.loaderService.closeMatSpinnerDialog(); this.loaderService.closeMatSpinnerDialog();
}, err => { }, err => {
if (err.message == "New password is required.") { if (err.message == "New password is required.") {
// this.newpassopen(); this.loaderService.showMatSpinnerDialog('');
this.newpassopen();
} else { } else {
} }
@ -135,20 +136,22 @@ export class LoginComponent implements OnInit{
* Defalut aws function * Defalut aws function
* @param email password,newpassword * @param email password,newpassword
*/ */
// newpassopen() { newpassopen() {
// let dialogRef = this.dialog.open(NewPasswordDialog, this.config); let dialogRef = this.dialog.open(NewPasswordDialog, this.config);
// dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
// if (result !== undefined) { if (result !== undefined) {
// let auth = { 'Username': this.email.split(/\s/).join(''), 'Password': this.password, 'newpassword': result }; let auth = { 'Username': this.email.split(/\s/).join(''), 'Password': this.password, 'newpassword': result };
// this.aws.dologin(auth).subscribe(res => { this.aws.dologin(auth).subscribe(res => {
// this.getCommonSettings(); this.getCommonSettings();
// this.router.navigate(['/']); this.loaderService.closeMatSpinnerDialog();
// }, err => { this.router.navigate(['/']);
// // alert(err.message); }, err => {
// }) this.loaderService.closeMatSpinnerDialog();
// } // alert(err.message);
// }); })
// } }
});
}
forgotopen() { forgotopen() {
this.status = true; this.status = true;
@ -181,79 +184,80 @@ export class LoginComponent implements OnInit{
* New password Dialog * New password Dialog
*/ */
// const newpassword = new FormControl('', Validators.required); const newpassword = new FormControl('', Validators.required);
// const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword)); const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword));
// @Component({ @Component({
// selector: 'app-jazz-dialog', selector: 'app-jazz-dialog',
// template: ` template: `
// <h5 class="mt-0">New Password Change.</h5> <h5 class="mt-0">New Password Change.</h5>
// <mat-form-field> <mat-form-field>
// <input matInput placeholder="New Password" #newpassword type="password" style="width: 100%;"> <input matInput placeholder="New Password" #newpassword [type]="hide1 ? 'password' : 'text'" style="width: 100%;">
<mat-icon class="passwordIcon" matSuffix (click)="hide1 = !hide1">{{hide1 ? 'visibility_off' : 'visibility'}}</mat-icon>
</mat-form-field>
// </mat-form-field> <br/>
<mat-form-field>
<input matInput placeholder="ConfirmPassword" #confirmPassword [type]="hide2 ? 'password' : 'text'" style="width: 100%;">
<mat-icon class="passwordIcon" matSuffix (click)="hide2 = !hide2">{{hide2 ? 'visibility_off' : 'visibility'}}</mat-icon>
</mat-form-field>
<small *ngIf="confirmPassword.value !='' && newpassword.value != confirmPassword.value" class="mat-text-warn">Passwords do not match.</small>
<br>
<button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
// <br/> `
// <mat-form-field> })
// <input matInput placeholder="ConfirmPassword" #confirmPassword type="password" style="width: 100%;"> export class NewPasswordDialog {
// </mat-form-field>
// <small *ngIf="confirmPassword.value !='' && newpassword.value != confirmPassword.value" class="mat-text-warn">Passwords do not match.</small> newpassword: any = newpassword;
confirmPassword: any = confirmPassword;
jazzMessage = 'Jazzy jazz jazz';
hide1: boolean = true;
hide2: boolean = true;
constructor(public dialogRef: MatDialogRef<NewPasswordDialog>) {
// <br> }
// <button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
// ` }
// })
// export class NewPasswordDialog {
// newpassword: any = newpassword;
// confirmPassword: any = confirmPassword;
// jazzMessage = 'Jazzy jazz jazz';
// constructor(public dialogRef: MatDialogRef<NewPasswordDialog>) {
// }
// }
// @Component({ @Component({
// selector: 'app-jazz-dialog', selector: 'app-jazz-dialog',
// template: ` template: `
// <h5 class="mt-0">Forgot Password</h5> <h5 class="mt-0">Forgot Password</h5>
// <mat-form-field> <mat-form-field>
// <input matInput placeholder="Email Id" #newpassword type="Email" style="width: 100%;"> <input matInput placeholder="Email Id" #newpassword type="Email" style="width: 100%;">
// </mat-form-field> </mat-form-field>
// <br> <br>
// <button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button> <button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
// ` `
// }) })
// export class ForgotPass { export class ForgotPass {
// newpassword: any = newpassword; newpassword: any = newpassword;
// confirmPassword: any = confirmPassword; confirmPassword: any = confirmPassword;
// jazzMessage = 'Jazzy jazz jazz'; jazzMessage = 'Jazzy jazz jazz';
// constructor(public dialogRef: MatDialogRef<ForgotPass>) { constructor(public dialogRef: MatDialogRef<ForgotPass>) {
// } }
// } }

View File

@ -18,7 +18,7 @@
</mat-form-field> </mat-form-field>
<span style="width: 25%"> <span style="width: 25%">
<button mat-button color="primary" (click)="resendOTP()" >{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button> <button mat-raised-button color="primary" (click)="resendOTP()" >{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
</span> </span>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>

View File

@ -72,6 +72,7 @@ export class OtpComponent implements OnInit {
this.dialogRef.close(); this.dialogRef.close();
this.loggedEmailID = this.data; this.loggedEmailID = this.data;
// alert('Password Reset Successfully'); // alert('Password Reset Successfully');
this.loaderService.showMatSpinnerDialog('');
this.newPasswordDialog(this.loggedEmailID); this.newPasswordDialog(this.loggedEmailID);
} }
else{ alert('OTP is invalid. Plesae enter correct OTP.!'); } else{ alert('OTP is invalid. Plesae enter correct OTP.!'); }
@ -80,7 +81,7 @@ export class OtpComponent implements OnInit {
newPasswordDialog(email) { newPasswordDialog(email) {
let dialogRef = this.dialog.open(NewPasswordDialog, this.config); let dialogRef = this.dialog.open(NewPasswordDialog2, this.config);
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
if (result !== undefined) { if (result !== undefined) {
@ -154,7 +155,7 @@ export class OtpComponent implements OnInit {
` `
}) })
export class NewPasswordDialog { export class NewPasswordDialog2 {
newpassword: any = newpassword; newpassword: any = newpassword;
confirmPassword: any = confirmPassword; confirmPassword: any = confirmPassword;
@ -162,7 +163,7 @@ export class OtpComponent implements OnInit {
hide2: boolean = true; hide2: boolean = true;
jazzMessage = 'Jazzy jazz jazz'; jazzMessage = 'Jazzy jazz jazz';
constructor(public dialogRef: MatDialogRef<NewPasswordDialog>) { constructor(public dialogRef: MatDialogRef<NewPasswordDialog2>) {
} }
@ -188,13 +189,13 @@ export class OtpComponent implements OnInit {
` `
}) })
export class ForgotPass { export class ForgotPass2 {
newpassword: any = newpassword; newpassword: any = newpassword;
confirmPassword: any = confirmPassword; confirmPassword: any = confirmPassword;
jazzMessage = 'Jazzy jazz jazz'; jazzMessage = 'Jazzy jazz jazz';
constructor(public dialogRef: MatDialogRef<ForgotPass>) { constructor(public dialogRef: MatDialogRef<ForgotPass2>) {
} }

View File

@ -21,8 +21,8 @@ import { RouterModule } from '@angular/router';
import { UserRoutes} from './users.routing'; import { UserRoutes} from './users.routing';
import { UserProfileComponent, ChangePasswordDialog } from './user-profile/user-profile.component'; import { UserProfileComponent, ChangePasswordDialog } from './user-profile/user-profile.component';
import { UserService } from './../service/user.service'; import { UserService } from './../service/user.service';
// import { NewPasswordDialog, ForgotPass } from '../../session/login/login.component'; import { NewPasswordDialog, ForgotPass } from '../../session/login/login.component';
import { NewPasswordDialog, ForgotPass } from '../../session/otp/otp.component'; import { NewPasswordDialog2, ForgotPass2 } from '../../session/otp/otp.component';
// import { HttpClientModule } from '@angular/common/http'; // import { HttpClientModule } from '@angular/common/http';
@NgModule({ @NgModule({
imports: [ imports: [