forget password

This commit is contained in:
bitbucket 2022-08-18 17:29:00 +05:30
parent 8a3b5a5d27
commit e7a2e6fe14
9 changed files with 413 additions and 76 deletions

BIN
ng6-seed/dist.zip Normal file

Binary file not shown.

View File

@ -42,7 +42,8 @@ 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 { NewPasswordDialog2, 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';
@ -65,6 +66,8 @@ import { PushNotifyService } from './shared/push-notify.service';
import { MatVideoModule } from 'mat-video';
import { ReqTokenInterceptor } from './_guard/req-token.interceptor';
import { DynamicNotifyComponent } from './layouts/dynamic-notify/dynamic-notify.component';
import { OtpComponent } from './session/otp/otp.component';
import { NotifierModule, NotifierOptions } from 'angular-notifier';
// import { SelectAllComponent } from './select-all/select-all.component';
// import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.component';
//import { SelectAllComponent } from './select-all/select-all.component';
@ -85,12 +88,52 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
};
// const socketConfig: SocketIoConfig = { url: environment.socketServerUrl, options: {} };
const pdCustomNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'right',
distance: 12
},
vertical: {
position: 'top',
distance: 32,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: 2000,
onClick: 'hide',
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};
@NgModule({
declarations: [
AppComponent,
AdminLayoutComponent,
AuthLayoutComponent,
OtpComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, HttpLoaderComponent,
IncomingCallComponent, VideoChatComponent, DynamicNotifyComponent,
],
@ -114,7 +157,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
MatCheckboxModule,
MatProgressBarModule,MatProgressSpinnerModule,
MatTooltipModule,
NotifierModule.withConfig(pdCustomNotifierOptions),
MatSelectModule,
MatCardModule,
MatBadgeModule,
@ -158,7 +201,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
},
MessagingService, AsyncPipe,LoaderService
],
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog,DynamicNotifyComponent]
// entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog,DynamicNotifyComponent]
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog,OtpComponent,DynamicNotifyComponent]
// IncomingCallComponent,VideoChatComponent,],
,bootstrap: [AppComponent]
})

View File

@ -19,7 +19,8 @@
</mat-form-field>
<mat-form-field style="width: 100%" class="mb-1">
<input matInput placeholder="Password" minlength= "8" type="password" name="password" required [(ngModel)]="password">
<input matInput placeholder="Password" minlength= "8"[type]="hide ? 'password' : 'text'" name="password" required [(ngModel)]="password">
<mat-icon class="passwordIcon" matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
</mat-form-field>
<button class="mat-green" mat-raised-button>SIGN IN</button><br/>
<div>
@ -49,5 +50,6 @@
<!-- © Copyright -->
</footer>
<!-- <a href="mailto:connect@sineedge.com">info@sineedge.com</a> -->
<!-- <a href="http://www.sineedge.com"> SineEdge Consulting Pvt Ltd. </a> -->

View File

@ -1,41 +1,91 @@
.form-bg {
//background-image:url('http://www.ssa.sineedge.com/beta/assets/images/login.jpg') !important;
//background-image: url(../../../assets/images/login_o.jpg);
//background-color: #F44336;
background: url(../../../assets/images/bg.png) repeat-x 0 0 #ffffff;
//height: 100vh !important;
background-position: center !important;
min-height: calc(90vh + 90px) !important;
}
// .form-bg {
// //background-image:url('http://www.ssa.sineedge.com/beta/assets/images/login.jpg') !important;
// //background-image: url(../../../assets/images/login_o.jpg);
// //background-color: #F44336;
// background: url(../../../assets/images/bg.png) repeat-x 0 0 #ffffff;
// //height: 100vh !important;
// background-position: center !important;
// min-height: calc(90vh + 90px) !important;
// }
.signin-page{
float: left;
width: 100%;
padding-bottom: 40px;
}
// .form-bg {
// float: left;
// width: 100%;
// background-color: repeat-x 0 0 #F44336;
// padding-bottom: 40px;
// }
.form-bg::before {
background-color: rgba(0, 0, 0, 0) !important;
}
.form-bg::after{
background-color: #E00201;
}
.page-title{
color:#E00201;
background-color:#ffffff;
font-weight: bold;
}
.page-footer{
color:#E00201;
background-color:#ffffff;
font-size: 14px;
}
.bottom-sec,.mat-green{
color:white !important;
font-weight: 700;
}
// .signin-page{
// float: left;
// width: 100%;
// padding-bottom: 40px;
// }
// // .form-bg {
// // float: left;
// // width: 100%;
// // background-color: repeat-x 0 0 #F44336;
// // padding-bottom: 40px;
// // }
// .form-bg::before {
// background-color: rgba(0, 0, 0, 0) !important;
// }
// .form-bg::after{
// background-color: #E00201;
// }
// .page-title{
// color:#E00201;
// background-color:#ffffff;
// font-weight: bold;
// }
// .page-footer{
// color:#E00201;
// background-color:#ffffff;
// font-size: 14px;
// }
// .bottom-sec,.mat-green{
// color:white !important;
// font-weight: 700;
// }
// .passwordIcon{
// font-size: larger !important;
// color: #f34325 !important;
// }
.form-bg {
//background-image:url('http://www.ssa.sineedge.com/beta/assets/images/login.jpg') !important;
//background-image: url(../../../assets/images/login_o.jpg);
//background-color: #F44336;
background: url(../../../assets/images/bg.png) repeat-x 0 0 #ffffff;
//height: 100vh !important;
background-position: center !important;
min-height: calc(90vh + 90px) !important;
}
.signin-page{
float: left;
width: 100%;
padding-bottom: 40px;
}
// .form-bg {
// float: left;
// width: 100%;
// background-color: repeat-x 0 0 #F44336;
// padding-bottom: 40px;
// }
.form-bg::before {
background-color: rgba(0, 0, 0, 0) !important;
}
.form-bg::after{
background-color: #E00201;
}
.page-title{
color:#E00201;
background-color:#ffffff;
font-weight: bold;
}
.page-footer{
color:#E00201;
background-color:#ffffff;
font-size: 14px;
}
.bottom-sec,.mat-green{
color:white !important;
font-weight: 700;
}
.passwordIcon{
font-size: larger !important;
color: #f34325 !important;
}

View File

@ -45,12 +45,14 @@ export class LoginComponent implements OnInit{
};
commonDetails: any;
dialogRef: MatDialogRef<OtpComponent, any>;
hide: boolean;
constructor(
private router: Router, public aws: AwsService, public dialog: MatDialog,
public shared:CognitoService,private messagingService:MessagingService,private dashBoardService:DashboardService) {
}
ngOnInit(){
this.hide = true;
this.loggedInCheck();
}
@ -126,7 +128,7 @@ export class LoginComponent implements OnInit{
if (data.status == 200) {
this.dialogRef = this.dialog.open(OtpComponent, {
data: this.email,
width: '60%',
width: '40%',
disableClose: true
});

View File

@ -1,4 +1,4 @@
<!--
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
OTP
@ -21,8 +21,48 @@
<mat-dialog-actions>
<div fxFlex="100" align="right">
<!--<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" mat-dialog-close matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>-->
<button mat-raised-button mat-icon-button (click)="updatepassword(otp.value)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Update Password" matTooltipPosition="below"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
</mat-dialog-actions> -->
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
OTP
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</h2>
<mat-dialog-content>
<mat-form-field style="width: 55%">
<input matInput placeholder="Enter OTP" #otp
type="text" maxlength="6">
</mat-form-field>
<span style="width: 25%">
<button mat-button color="primary" *ngIf="timeLeft !=0"
>{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
<button mat-raised-button color="primary" *ngIf="timeLeft ==0"
(click)="resendOTP()" >{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
</span>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="100" align="right">
<!--<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" mat-dialog-close matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>-->
<!-- <button mat-raised-button mat-icon-button (click)="updatePassword(otp.value)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Update Password" matTooltipPosition="below"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button (click)="updatepassword(otp.value)" matTooltip="VERIFY" matTooltipPosition="below" color="primary" [disabled]="(otp.value.length < 6)"><span>{{'VERIFY'}}</span></button>
<!-- <p>{{timeLeft}} Seconds Left....</p> -->
</div>
</mat-dialog-actions>
<notifier-container></notifier-container>

View File

@ -1,18 +1,36 @@
// mat-form-field {
// margin: 0 2%;
// }
// .paragraph_change {
// color: #fff !important;
// background-color: #e00201 !important;
// // padding: 10px !important;
// }
// .cdk-global-overlay-wrapper{
// justify-content: center !important;
// }
// mat-dialog-actions{
// border-top: 2px solid #e00201;
// }
// .mat-form-field-appearance-legacy .mat-hint{
// color:rgba(0, 0, 0, 0.8) !important;
// }
mat-form-field {
margin: 0 2%;
}
margin: 0 2%;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
// padding: 10px !important;
color: #fff !important;
background-color: #e00201 !important;
// padding: 10px !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
mat-dialog-actions{
border-top: 2px solid #e00201;
}
mat-dialog-actions{
border-top: 2px solid #e00201;
}
.mat-form-field-appearance-legacy .mat-hint{
color:rgba(0, 0, 0, 0.8) !important;
color:rgba(0, 0, 0, 0.8) !important;
}

View File

@ -1,7 +1,13 @@
import { Component, OnInit,Inject } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition,MatDialogConfig} from '@angular/material';
import { DashboardService } from 'app/dashboard/dashboard.service';
import { NotifierService } from 'angular-notifier';
import { FormControl, Validators } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { AwsService } from 'app/AwsService/aws.service';
import { Router } from '@angular/router';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import Swal from 'sweetalert2';
@Component({
selector: 'app-otp',
templateUrl: './otp.component.html',
@ -9,10 +15,31 @@ import { NotifierService } from 'angular-notifier';
})
export class OtpComponent implements OnInit {
//public notifier : NotifierService;
constructor( private dialogRef: MatDialogRef<OtpComponent>,private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public data: any,private dashBoardService:DashboardService)
timeLeft: number = 0;
loggedEmailID:any="";
interval;
config: MatDialogConfig = {
disableClose: false,
width: '',
height: '',
position: {
top: '',
bottom: '',
left: '',
right: ''
}
};
constructor(private notifier: NotifierService,private dialogRef: MatDialogRef<OtpComponent>,private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public data: any,private dashBoardService:DashboardService,public aws: AwsService,private loaderService:LoaderService,private router: Router, )
{
this.loggedEmailID = this.data;
this.timeLeft = 60;
this.interval = setInterval(() => {
if(this.timeLeft > 0) {
this.timeLeft--;
} else {
clearInterval(this.interval);
}
},1000)
}
ngOnInit() {
@ -20,22 +47,175 @@ export class OtpComponent implements OnInit {
updatepassword(otp)
{
console.log('data');
console.log(this.data);
console.log(this.data,otp);
this.dashBoardService.resetpassword(this.data,otp).subscribe(
data => {
console.log('data');
console.log(data)
console.log('resetpassword api res data',data);
if (data.status == 200) {
alert('Password Reset Successfully');
this.dialogRef.close();
this.dialogRef.close();
this.loggedEmailID = this.data;
// alert('Password Reset Successfully');
this.newPasswordDialog(this.loggedEmailID);
}
else
{
alert('OTP is invalid. Plesae enter correct OTP.!');
else{ alert('OTP is invalid. Plesae enter correct OTP.!'); }
});
// 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.!');
}
// }
// })
}
newPasswordDialog(email) {
let dialogRef = this.dialog.open(NewPasswordDialog, this.config);
dialogRef.afterClosed().subscribe(result => {
if (result !== undefined) {
console.log(result);
Swal('Password Successfully Changed..!');
this.notifier.notify("success","Password Successfully Changed..")
let auth = { 'Username': email, 'Password': 'temp1234', 'newpassword': result };
this.aws.dologin(auth).subscribe(res => {
this.getCommonSettings();
this.router.navigate(['authentication/login']);
// this.router.navigate(['personal_discussion/pdlist']);
// localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]);
// //this.router.navigate(['/']);
// //alert(localStorage.getItem('user_role'))
// this.loaderService.closeMatSpinnerDialog();
// if(res.idToken.payload["custom:role_id"]=='11')
// {
// this.router.navigate(['sales-pd-list/list-pd']);
// }
// else
// {
// this.router.navigate(['personal_discussion/pdlist']);
// }
}, 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));
}
})
}
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)
});
}
}
/** ======================= 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: `
<h5 class="mt-0">New Password Change.</h5>
<mat-form-field>
<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>
<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>
<notifier-container></notifier-container>
`
})
export class NewPasswordDialog {
newpassword: any = newpassword;
confirmPassword: any = confirmPassword;
hide1: boolean = true;
hide2: boolean = true;
jazzMessage = 'Jazzy jazz jazz';
constructor(public dialogRef: MatDialogRef<NewPasswordDialog>) {
}
}
/** ==================== New password Dialog Ends Here ======================== */
/** ==================== Forgot Password Dialog Starts Here =================== */
@Component({
selector: 'app-jazz-dialog',
template: `
<h5 class="mt-0">Forgot Password</h5>
<mat-form-field>
<input matInput placeholder="Email Id" #newpassword type="Email" style="width: 100%;">
</mat-form-field>
<br>
<button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
`
})
export class ForgotPass {
newpassword: any = newpassword;
confirmPassword: any = confirmPassword;
jazzMessage = 'Jazzy jazz jazz';
constructor(public dialogRef: MatDialogRef<ForgotPass>) {
}
}
/** ==================== Forgot Password Dialog Ends Here =================== */

View File

@ -17,7 +17,7 @@ import { ForgotPasswordComponent } from './forgot-password/forgot-password.compo
import { LockScreenComponent } from './lockscreen/lockscreen.component';
import { SessionRoutes } from './session.routing';
import { OtpComponent } from './otp/otp.component';
import { NewPasswordDialog, OtpComponent } from './otp/otp.component';
@NgModule({
imports: [
@ -32,6 +32,7 @@ import { OtpComponent } from './otp/otp.component';
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
FlexLayoutModule,MatDialogModule
],
declarations: [
@ -39,9 +40,9 @@ import { OtpComponent } from './otp/otp.component';
RegisterComponent,
ForgotPasswordComponent,
LockScreenComponent,
OtpComponent
],
entryComponents:[OtpComponent]
// entryComponents:[NewPasswordDialog,OtpComponent]
})
export class SessionModule {}