diff --git a/ng6-seed/SalesPd_PWA_FlyHi(01-07-2022)Testing.zip b/ng6-seed/SalesPd_PWA_FlyHi(01-07-2022)Testing.zip
deleted file mode 100644
index f4afd8e..0000000
Binary files a/ng6-seed/SalesPd_PWA_FlyHi(01-07-2022)Testing.zip and /dev/null differ
diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts
index 3809af9..9f64fea 100755
--- a/ng6-seed/src/app/app.module.ts
+++ b/ng6-seed/src/app/app.module.ts
@@ -40,7 +40,7 @@ import { AuthLayoutComponent } from './layouts/auth/auth-layout.component';
import { SharedModule } from './shared/shared.module';
import { AwsService } from './AwsService/aws.service';
import { TokenInterceptor } from './_guard/token.interceptor';
-import { NewPasswordDialog, ForgotPass } from './session/login/login.component';
+import { NewPasswordDialog, ForgotPass } from './session/otp/otp.component';
import { AuthGuard } from './_guard/auth.guard';
import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe';
import { ResizableModule } from 'angular-resizable-element';
diff --git a/ng6-seed/src/app/session/login/login.component.ts b/ng6-seed/src/app/session/login/login.component.ts
index 572f3a3..ab7057a 100755
--- a/ng6-seed/src/app/session/login/login.component.ts
+++ b/ng6-seed/src/app/session/login/login.component.ts
@@ -106,7 +106,7 @@ export class LoginComponent implements OnInit{
this.loaderService.closeMatSpinnerDialog();
}, err => {
if (err.message == "New password is required.") {
- this.newpassopen();
+ // this.newpassopen();
} else {
}
@@ -114,27 +114,27 @@ export class LoginComponent implements OnInit{
//alert(err.message);
})
}
- /**
- * New password set
- * Defalut aws function
- * @param email password,newpassword
- */
- newpassopen() {
- const mailid = this.email.split(/\s/).join('');
- const password = this.password.split(/\s/).join('');
- let dialogRef = this.dialog.open(NewPasswordDialog, this.config);
- dialogRef.afterClosed().subscribe(result => {
- if (result !== undefined) {
- let auth = { 'Username': mailid, 'Password': password, 'newpassword': result };
- this.aws.dologin(auth).subscribe(res => {
- this.getCommonSettings();
- this.router.navigate(['/']);
- }, err => {
- // alert(err.message);
- })
- }
- });
- }
+ // /**
+ // * New password set
+ // * Defalut aws function
+ // * @param email password,newpassword
+ // */
+ // newpassopen() {
+ // const mailid = this.email.split(/\s/).join('');
+ // const password = this.password.split(/\s/).join('');
+ // let dialogRef = this.dialog.open(NewPasswordDialog, this.config);
+ // dialogRef.afterClosed().subscribe(result => {
+ // if (result !== undefined) {
+ // let auth = { 'Username': mailid, 'Password': password, 'newpassword': result };
+ // this.aws.dologin(auth).subscribe(res => {
+ // this.getCommonSettings();
+ // this.router.navigate(['/']);
+ // }, err => {
+ // // alert(err.message);
+ // })
+ // }
+ // });
+ // }
forgotopen() {
this.status = true;
@@ -184,79 +184,79 @@ export class LoginComponent implements OnInit{
* New password Dialog
*/
-const newpassword = new FormControl('', Validators.required);
-const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword));
+// const newpassword = new FormControl('', Validators.required);
+// const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword));
-@Component({
- selector: 'app-jazz-dialog',
- template: `
-
New Password Change.
+// @Component({
+// selector: 'app-jazz-dialog',
+// template: `
+// New Password Change.
-
-
+//
+//
-
+//
-
-
-
-
+//
+//
+//
+//
- Passwords do not match.
+// Passwords do not match.
-
+//
-
+//
- `
-})
-export class NewPasswordDialog {
+// `
+// })
+// export class NewPasswordDialog {
- newpassword: any = newpassword;
- confirmPassword: any = confirmPassword;
- jazzMessage = 'Jazzy jazz jazz';
+// newpassword: any = newpassword;
+// confirmPassword: any = confirmPassword;
+// jazzMessage = 'Jazzy jazz jazz';
- constructor(public dialogRef: MatDialogRef) {
+// constructor(public dialogRef: MatDialogRef) {
- }
+// }
-}
+// }
-@Component({
- selector: 'app-jazz-dialog',
- template: `
- Forgot Password
+// @Component({
+// selector: 'app-jazz-dialog',
+// template: `
+// Forgot Password
-
-
+//
+//
-
+//
-
+//
-
+//
- `
-})
-export class ForgotPass {
+// `
+// })
+// export class ForgotPass {
- newpassword: any = newpassword;
- confirmPassword: any = confirmPassword;
- jazzMessage = 'Jazzy jazz jazz';
+// newpassword: any = newpassword;
+// confirmPassword: any = confirmPassword;
+// jazzMessage = 'Jazzy jazz jazz';
- constructor(public dialogRef: MatDialogRef) {
+// constructor(public dialogRef: MatDialogRef) {
- }
+// }
-}
+// }
diff --git a/ng6-seed/src/app/session/otp/otp.component.html b/ng6-seed/src/app/session/otp/otp.component.html
index b341195..edba7e8 100644
--- a/ng6-seed/src/app/session/otp/otp.component.html
+++ b/ng6-seed/src/app/session/otp/otp.component.html
@@ -12,17 +12,20 @@
-
+
+
+
+
-
+
diff --git a/ng6-seed/src/app/session/otp/otp.component.ts b/ng6-seed/src/app/session/otp/otp.component.ts
index 6cb4543..2389d26 100644
--- a/ng6-seed/src/app/session/otp/otp.component.ts
+++ b/ng6-seed/src/app/session/otp/otp.component.ts
@@ -1,6 +1,11 @@
import { Component, OnInit, Inject } from '@angular/core';
-import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material';
+import { MatDialogRef, MatDialog, MAT_DIALOG_DATA, MatDialogConfig } from '@angular/material';
import { DashboardService } from 'app/dashboard/dashboard.service';
+import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
+import { CustomValidators } from 'ng2-validation';
+import { Router } from "@angular/router";
+import { AwsService } from '../../AwsService/aws.service';
+import { LoaderService } from 'app/shared/loaderService/loader.service';
@Component({
selector: 'app-otp',
@@ -8,30 +13,199 @@ import { DashboardService } from 'app/dashboard/dashboard.service';
styleUrls: ['./otp.component.scss']
})
export class OtpComponent implements OnInit {
-
- constructor(private dialogRef: MatDialogRef,private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public data: any,private dashBoardService:DashboardService) { }
-
- ngOnInit() {
+ timeLeft: number = 0;
+ loggedEmailID:any="";
+ interval;
+ config: MatDialogConfig = {
+ disableClose: false,
+ width: '',
+ height: '',
+ position: {
+ top: '',
+ bottom: '',
+ left: '',
+ right: ''
+ }
+ };
+ constructor(private dialogRef: MatDialogRef,private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public data: any,private dashBoardService:DashboardService,private loaderService:LoaderService,private router: Router,public aws: AwsService) {
+ this.loggedEmailID = this.data;
+ this.timeLeft = 60;
+ this.interval = setInterval(() => {
+ if(this.timeLeft > 0) {
+ this.timeLeft--;
+ } else {
+ clearInterval(this.interval);
+ }
+ },1000)
}
- updatepassword(otp)
- {
- console.log('data');
- console.log(this.data);
- this.dashBoardService.resetpassword(this.data,otp).subscribe(
- data => {
- console.log('data');
- console.log(data)
- if (data.status == 200) {
- alert('Password Reset Successfully');
- this.dialogRef.close();
- }
- else
- {
- alert('OTP is invalid. Plesae enter correct OTP.!');
-
- }
-
- })
-}
+
+ ngOnInit() {}
+
+ resendOTP() {
+ this.timeLeft = 60;
+ this.dashBoardService.generateotp(this.loggedEmailID.split(/\s/).join('')).subscribe(
+ response => {
+ // if(response.status == 200)
+ this.interval = setInterval(() => {
+ if(this.timeLeft > 0) {
+ this.timeLeft--;
+ } else {
+ clearInterval(this.interval);
+ // alert(response.msg);//comment this.
+ }
+ },1000)
+ });
+ }
+
+ // updatepassword(otp)
+ // {
+ // console.log('data');
+ // console.log(this.data);
+ // this.dashBoardService.resetpassword(this.data,otp).subscribe(
+ // data => {
+ // console.log('data');
+ // console.log(data)
+ // if (data.status == 200) {
+ // alert('Password Reset Successfully');
+ // this.dialogRef.close();
+ // }
+ // else
+ // {
+ // alert('OTP is invalid. Plesae enter correct OTP.!');
+
+ // }
+
+ // })
+ // }
+
+ updatepassword(otp)
+ {
+ this.dashBoardService.resetpassword(this.loggedEmailID,otp).subscribe(
+ data => {
+ console.log('resetpassword api res data',data);
+ if (data.status == 200) {
+ this.dialogRef.close();
+ this.loggedEmailID = this.data;
+ // alert('Password Reset Successfully');
+ this.loaderService.showMatSpinnerDialog('');
+ this.newpassopen(this.loggedEmailID);
+ }
+ else{ alert('OTP is invalid. Plesae enter correct OTP.!'); }
+ });
+ }
+
+ /**
+ * New password set
+ * Defalut aws function
+ * @param email password,newpassword
+ */
+ newpassopen(email) {
+ let dialogRef = this.dialog.open(NewPasswordDialog, this.config);
+ dialogRef.afterClosed().subscribe(result => {
+ if (result !== undefined) {
+ console.log(result);
+ let auth = { 'Username': email, 'Password': 'temp1234', 'newpassword': result };
+ this.aws.dologin(auth).subscribe(res => {
+ this.getCommonSettings();
+ // this.router.navigate(['/']);
+ this.router.navigate(['personal_discussion/pdlist']);
+ localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]);
+
+ this.loaderService.closeMatSpinnerDialog();
+ if(res.idToken.payload["custom:role_id"]=='30' || res.idToken.payload["custom:role_id"]=='10' || res.idToken.payload["custom:role_id"]=='11' || res.idToken.payload["custom:role_id"]=='13' || res.idToken.payload["custom:role_id"]=='15' || res.idToken.payload["custom:role_id"]=='17' || res.idToken.payload["custom:role_id"]=='19')
+ {
+ this.router.navigate(['/sales-pd-list']);
+ } else if(res.idToken.payload ["custom:role_id"] == '20'){
+ this.router.navigate(['/fly-hi'])
+ }
+ else
+ {
+ alert('Sales User Roles only allowed');
+ this.aws.logout().subscribe(res=>{
+ this.router.navigate(['/authentication/login']);
+ })
+ }
+
+ }, err => {
+ this.loaderService.closeMatSpinnerDialog();
+ // alert(err.message);
+ })
+ }
+ });
+ }
+
+ commonDetails: any;
+ getCommonSettings(){
+ this.dashBoardService.getCommonSettingsConfig().subscribe(res=>{
+ this.commonDetails = res;
+ if(this.commonDetails.dataStatus == true){
+ localStorage.setItem("commonSettings",JSON.stringify(this.commonDetails.records));
+ }
+ })
+ }
}
+/** ======================= OtpComponent Ends Here ============================== */
+
+/** ==================== New password Dialog Starts Here ======================== */
+
+ const newpassword = new FormControl('', Validators.required);
+ const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword));
+ @Component({
+ selector: 'app-jazz-dialog',
+ template: `
+ New Password Change.
+
+
+ {{hide1 ? 'visibility_off' : 'visibility'}}
+
+
+
+
+ {{hide2 ? 'visibility_off' : 'visibility'}}
+
+
+ Passwords do not match.
+
+
+
+`
+ })
+
+ export class NewPasswordDialog {
+
+ newpassword: any = newpassword;
+ confirmPassword: any = confirmPassword;
+ hide1: boolean = true;
+ hide2: boolean = true;
+ jazzMessage = 'Jazzy jazz jazz';
+
+ constructor(public dialogRef: MatDialogRef) { }
+ }
+
+/** ==================== New password Dialog Ends Here ======================== */
+
+/** ==================== Forgot Password Dialog Starts Here =================== */
+
+ @Component({
+ selector: 'app-jazz-dialog',
+ template: `
+ Forgot Password
+
+
+
+
+
+
+ ` })
+
+export class ForgotPass {
+
+ newpassword: any = newpassword;
+ confirmPassword: any = confirmPassword;
+ jazzMessage = 'Jazzy jazz jazz';
+
+ constructor(public dialogRef: MatDialogRef) {}
+
+ }
+/** ==================== Forgot Password Dialog Ends Here =================== */
\ No newline at end of file
diff --git a/ng6-seed/src/app/settings/users/users.module.ts b/ng6-seed/src/app/settings/users/users.module.ts
index 766383b..8f45d72 100755
--- a/ng6-seed/src/app/settings/users/users.module.ts
+++ b/ng6-seed/src/app/settings/users/users.module.ts
@@ -21,7 +21,7 @@ import { RouterModule } from '@angular/router';
import { UserRoutes} from './users.routing';
import { UserProfileComponent, ChangePasswordDialog } from './user-profile/user-profile.component';
import { UserService } from './../service/user.service';
-import { NewPasswordDialog, ForgotPass } from '../../session/login/login.component';
+import { NewPasswordDialog, ForgotPass } from '../../session/otp/otp.component';
// import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [