diff --git a/src/app/pages/forgot/forgot.page.html b/src/app/pages/forgot/forgot.page.html index a224505..a5896b8 100644 --- a/src/app/pages/forgot/forgot.page.html +++ b/src/app/pages/forgot/forgot.page.html @@ -48,10 +48,10 @@ Code has been sent to the your registered email - + - + Continue diff --git a/src/app/pages/forgot/forgot.page.ts b/src/app/pages/forgot/forgot.page.ts index e32ac4a..e9f9fb5 100644 --- a/src/app/pages/forgot/forgot.page.ts +++ b/src/app/pages/forgot/forgot.page.ts @@ -1,13 +1,8 @@ -/* - Authors : initappz (Rahul Jograna) - Website : https://initappz.com/ - App Name : E-Learning App Template - This App Template Source code is licensed as per the - terms found in the Website https://initappz.com/license - Copyright and Good Faith Purchasers © 2021-present initappz. -*/ import { Router } from '@angular/router'; import {Component, OnInit, ViewChild} from '@angular/core'; +import { WrenchService } from 'src/app/services/wrench.service'; +import { SessionDataProviderService } from 'src/app/store/session-data-provider.service'; +import { BlogDataService } from 'src/app/store/blog-data.service'; @Component({ selector: 'app-forgot', @@ -17,25 +12,146 @@ import {Component, OnInit, ViewChild} from '@angular/core'; export class ForgotPage implements OnInit { @ViewChild('username') username; @ViewChild('password') password; + @ViewChild('reset_pin') reset_pin; tab = 1 + reset_uid:string = ''; + m_uid:string = ''; + password_reset_id:number = 0; constructor( - private router: Router - ) { } + private router: Router, + private wrenchService: WrenchService, + public sessionDataProviderService:SessionDataProviderService, + public blogDataService:BlogDataService + ) { + + } ngOnInit() { } + + reqData: { + 'action':11013, email: string, sessionid: string, channel:'MOBILE' + }; + resetResult:any; onEnterEmail(){ + this.reset_uid = ''; + this.m_uid = ''; if (this.username == null || this.username == '' || this.validateEmail(this.username) == false) { this.showAlert('Invalid Login', 'Enter username(email) to continue'); return; } - this.tab =3; + + this.reqData = { 'action':11013,email: this.username, sessionid: 'DUMMY-APP-SESSION', channel:'MOBILE' } + this.wrenchService.startPassReset(this.reqData).subscribe( + resetResult => { + this.resetResult = resetResult; + console.log("INTERNAL RETURN->" + this.resetResult); + /* + 'm_uid' => string '43c766d9-403d-4125-9983-63c21960b187' (length=36) + 'password_reset_id' => string '109' (length=3) + 'reset_uid' => string '48dc78ef-c5c4-4e3a-937c-05f79eeb3f0a' (length=36) + 'result' => string 'YES I GET TO BACK END' (length=21) + 'server_name' => string 'https://dev-users.wrenchboard.com' (length=33) + 'internal_return' => int 0 + */ + if (resetResult != null + && resetResult.internal_return == 0 && + resetResult.password_reset_id > 0 && + resetResult.reset_uid !='' && + resetResult.m_uid != '' ) { + this.reset_uid = resetResult.reset_uid; + this.m_uid = resetResult.m_uid; + this.password_reset_id = resetResult.password_reset_id; + this.tab =3; + } + else + { + alert("SOME WENT WROMNG"); + } + + } + ); + + } onPassword() { this.router.navigate(['new-password']); } + + verifyData: { + 'action':730, + email: string, + sessionid: string, + reset_uid: string, + m_uid: string, + reset_pin: string, + step:200, + channel:'MOBILE' + }; +/* + 'sessionid' => string 'DUMMY-CANNOT_BE_EMPTY' (length=21) + 'reset_link' => string '36dfec6e557768511ffc87bdc861fac4543ae5758f933f8a7c92a7a70960fa3f' (length=64) + 'newpass' => string 'your-new-password' (length=17) + 'step' => int 300 + 'action' => int 730 + + this.reset_uid = resetResult.reset_uid; + this.m_uid = resetResult.m_uid; + this.password_reset_id = resetResult.password_reset_id; + + */ + onCompleteReset(){ + + if (this.username == null || this.username == '' || this.validateEmail(this.username) == false) { + this.showAlert('Invalid Login', 'Enter username(email) to continue'); + return; + } + + this.verifyData= { + 'action':730, + email: this.username, + sessionid: 'START-SESSION', + reset_uid: this.reset_uid, + m_uid: this.m_uid, + reset_pin: this.reset_pin, + step:300, + channel:'MOBILE' + }; + + + this.wrenchService.verifyPassReset(this.verifyData).subscribe( + resetResult => { + this.resetResult = resetResult; + console.log("INTERNAL RETURN->" + this.resetResult); + /* + 'm_uid' => string '43c766d9-403d-4125-9983-63c21960b187' (length=36) + 'password_reset_id' => string '109' (length=3) + 'reset_uid' => string '48dc78ef-c5c4-4e3a-937c-05f79eeb3f0a' (length=36) + 'result' => string 'YES I GET TO BACK END' (length=21) + 'server_name' => string 'https://dev-users.wrenchboard.com' (length=33) + 'internal_return' => int 0 + */ + // if (resetResult != null + // && resetResult.internal_return == 0 && + // resetResult.password_reset_id > 0 && + // resetResult.reset_uid !='' && + // resetResult.m_uid != '' ) { + // this.reset_uid = resetResult.reset_uid; + // this.m_uid = resetResult.m_uid; + // this.password_reset_id = resetResult.password_reset_id; + // this.tab =3; + // } + // else + // { + // alert("SOME WENT WROMNG"); + // } + + } + ); + + } onLogin(){ this.router.navigate(['login']); } diff --git a/src/app/services/wrench.service.ts b/src/app/services/wrench.service.ts index a784c4b..1431439 100644 --- a/src/app/services/wrench.service.ts +++ b/src/app/services/wrench.service.ts @@ -24,6 +24,15 @@ export class WrenchService { ); } + startPassReset(reqData){ + return this.getPostData('startresetpasword', reqData); + // + } + + verifyPassReset(reqData){ + return this.getPostData('stepresetpass', reqData); + // + } createUser(reqData) { return this.getPostData('createuser', reqData); }