diff --git a/ng-seed/src/app/session-services/session.service.ts b/ng-seed/src/app/session-services/session.service.ts index 83ec5b7..a47c34e 100644 --- a/ng-seed/src/app/session-services/session.service.ts +++ b/ng-seed/src/app/session-services/session.service.ts @@ -30,9 +30,9 @@ export class SessionService { // return this._http.post(this.apiUrl + 'login', {'email':params.email,'password':params.password}) } - resetPasswordApi(forgotDetails,resetPassword): Observable { - console.log(forgotDetails,resetPassword) - return this._http.post(this.apiUrl + "reset-password/"+forgotDetails.email+'/'+forgotDetails.token,resetPassword) + resetPasswordApi(email,token,resetPassword): Observable { + console.log(resetPassword) + return this._http.post(this.apiUrl + "reset-password/"+email+'/'+token,resetPassword) // return this._http.post(this.apiUrl + 'login', {'email':params.email,'password':params.password}) } diff --git a/ng-seed/src/app/session/forgot-password/forgot-password-component.html b/ng-seed/src/app/session/forgot-password/forgot-password-component.html index 23d45b5..1ad6d52 100644 --- a/ng-seed/src/app/session/forgot-password/forgot-password-component.html +++ b/ng-seed/src/app/session/forgot-password/forgot-password-component.html @@ -26,4 +26,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/ng-seed/src/app/session/forgot-password/forgot-password.component.ts b/ng-seed/src/app/session/forgot-password/forgot-password.component.ts index 2fd140d..ea3b315 100644 --- a/ng-seed/src/app/session/forgot-password/forgot-password.component.ts +++ b/ng-seed/src/app/session/forgot-password/forgot-password.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit,ViewEncapsulation } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import {Router} from "@angular/router"; +import { NotifierService } from 'angular-notifier'; import { SessionService } from 'app/session-services/session.service'; @Component({ @@ -16,7 +17,7 @@ export class ForgotPasswordComponent { form: FormGroup; forgotTokenEmail: any; - constructor(private router: Router,public _ser:SessionService) { } + constructor(private router: Router,public _ser:SessionService,private notifierService: NotifierService,) { } ngOnInit() { this.form = new FormGroup({ @@ -27,13 +28,14 @@ export class ForgotPasswordComponent { submit(){ console.log(this.form.value) const mailid = this.form['value'].email.split(/\s/).join(''); - let forgotMail = {'email':mailid} + let forgotMail = {'email':mailid,'urlDomain':window.location.origin} console.log(forgotMail) this._ser.getForgotToken(forgotMail).subscribe(res => { console.log(res) this.forgotTokenEmail = res this._ser.getForgotDetails(this.forgotTokenEmail) - this.router.navigate(['authentication/reset-password']) + this.notifierService.notify('warning', res.message); + //this.router.navigate(['authentication/reset-password']) }, err => { //alert(err.message); diff --git a/ng-seed/src/app/session/reset-password/reset-password.component.ts b/ng-seed/src/app/session/reset-password/reset-password.component.ts index e8973fd..1a44e8f 100644 --- a/ng-seed/src/app/session/reset-password/reset-password.component.ts +++ b/ng-seed/src/app/session/reset-password/reset-password.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { SessionService } from 'app/session-services/session.service'; @Component({ @@ -12,14 +12,17 @@ import { SessionService } from 'app/session-services/session.service'; export class ResetPasswordComponent implements OnInit { form: FormGroup; forgotApiDetails: string; - - constructor(private router: Router,public _ser:SessionService) { } + email:any=[]; + token:any = []; + constructor(private router: Router,public _ser:SessionService,private route: ActivatedRoute) { } ngOnInit(): void { - this._ser.name.subscribe(data=>{ - this.forgotApiDetails = data; - console.log(this.forgotApiDetails) - }); + // this._ser.name.subscribe(data=>{ + // this.forgotApiDetails = data; + // console.log(this.forgotApiDetails) + // }); + this.email = this.route.snapshot.paramMap.get('email'); + this.token = this.route.snapshot.paramMap.get('token'); this.form = new FormGroup({ password: new FormControl('',[Validators.required,Validators.maxLength(10)]), @@ -32,7 +35,7 @@ export class ResetPasswordComponent implements OnInit { submit(){ console.log(this.form.value) - this._ser.resetPasswordApi(this.forgotApiDetails,this.form.value).subscribe(res => { + this._ser.resetPasswordApi(this.email, this.token ,this.form.value).subscribe(res => { console.log(res) if(res.status == 200){ this.router.navigate(['authentication/login']) diff --git a/ng-seed/src/app/session/session.routing.ts b/ng-seed/src/app/session/session.routing.ts index 70b20ea..3ce26ca 100644 --- a/ng-seed/src/app/session/session.routing.ts +++ b/ng-seed/src/app/session/session.routing.ts @@ -28,7 +28,7 @@ export const SessionRoutes: Routes = [{ path: 'otp', component: OtpComponent },{ - path: 'reset-password', + path: 'reset-password/:email/:token', component: ResetPasswordComponent } ] diff --git a/ng-seed/src/environments/environment.ts b/ng-seed/src/environments/environment.ts index a5d99a4..1a53074 100644 --- a/ng-seed/src/environments/environment.ts +++ b/ng-seed/src/environments/environment.ts @@ -7,12 +7,12 @@ export const environment = { production: false, environmentName: 'Testing Environment',//Localhost Environment. // apiEndpoint:'http://venbainfotech.com:5000/api/', -// apiEndpoint:'http://192.168.1.20:8080/api/', + apiEndpoint:'http://192.168.1.19:8080/api/', // apiEndpoint:'https://api.venbait.in/api/', // apiEndpoint:'http://venbainfotech.com:5000/api/', // apiEndpoint:'http://192.168.1.17:8080/api/', - apiEndpoint:'https://api.venbait.in/api/', +// apiEndpoint:'https://api.venbait.in/api/', //EndUser URL endUserUrl: window.location.origin+'/#/customer/',