From 7700850a450045690a58bca6a33e72967a78701a Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 10 Sep 2023 19:03:01 -0400 Subject: [PATCH] reset password --- src/app/pages/forgot/forgot.page.ts | 2 +- src/app/pages/home/home.page.scss | 1 + .../pages/new-password/new-password.page.html | 4 +- .../pages/new-password/new-password.page.ts | 57 +++++++++++++++++-- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/app/pages/forgot/forgot.page.ts b/src/app/pages/forgot/forgot.page.ts index b0aa93f..62be3a5 100644 --- a/src/app/pages/forgot/forgot.page.ts +++ b/src/app/pages/forgot/forgot.page.ts @@ -141,7 +141,7 @@ export class ForgotPage implements OnInit { // this.reset_uid = resetResult.reset_uid; // this.m_uid = resetResult.m_uid; // this.password_reset_id = resetResult.password_reset_id; - this.router.navigate(['new-password']); + this.router.navigate(['new-password'],{state:resetResult}); } else { diff --git a/src/app/pages/home/home.page.scss b/src/app/pages/home/home.page.scss index bed4e7e..bb96ebb 100644 --- a/src/app/pages/home/home.page.scss +++ b/src/app/pages/home/home.page.scss @@ -322,6 +322,7 @@ ion-content { .name { font-family: 'bold'; margin-top: 5px; + padding: 5px; } .price { diff --git a/src/app/pages/new-password/new-password.page.html b/src/app/pages/new-password/new-password.page.html index 09d2402..99cd9ca 100644 --- a/src/app/pages/new-password/new-password.page.html +++ b/src/app/pages/new-password/new-password.page.html @@ -17,12 +17,12 @@ - + - + diff --git a/src/app/pages/new-password/new-password.page.ts b/src/app/pages/new-password/new-password.page.ts index a617f4a..f092910 100644 --- a/src/app/pages/new-password/new-password.page.ts +++ b/src/app/pages/new-password/new-password.page.ts @@ -8,7 +8,9 @@ */ import { Router } from '@angular/router'; import { NavController } from '@ionic/angular'; -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit, ViewChild} from '@angular/core'; +import {WrenchService} from "../../services/wrench.service"; +import {SessionDataProviderService} from "../../store/session-data-provider.service"; @Component({ selector: 'app-new-password', @@ -16,11 +18,15 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./new-password.page.scss'], }) export class NewPasswordPage implements OnInit { +@ViewChild('confirm_new_password') confirm_new_password; +@ViewChild('new_password') new_password; resetResult;any; constructor( private navctr: NavController, - private router: Router + private router: Router, + private wrenchService: WrenchService, + public sessionDataProviderService:SessionDataProviderService ) { this.resetResult = this.router.getCurrentNavigation().extras.state; if ( this.resetResult != null @@ -28,9 +34,6 @@ export class NewPasswordPage implements OnInit { this.resetResult.lostpass_id > 0 && this.resetResult.reset_uid !='' && this.resetResult.m_uid != '' ) { - // this.reset_uid = resetResult.reset_uid; - // this.m_uid = resetResult.m_uid; - // this.password_reset_id = resetResult.password_reset_id; } else { @@ -49,8 +52,50 @@ export class NewPasswordPage implements OnInit { this.router.navigate(['login']); } + postData: { + action:number, + step: number, + m_uid: string, + reset_uid: string, + sessionid: string, + reset_link: string, + channel:'MOBILE', + newpass: string + }; + completeResetResults:any; + onCompleteNewReset(){ + if (this.new_password.length < 8 || (this.new_password != this.confirm_new_password) ){ + this.showAlert('Error', 'Enter new password to continue'); + return; + } + this.postData = { + action:730, + step: 300, + m_uid: this.resetResult.m_uid, + reset_uid: this.resetResult.reset_uid, + sessionid: 'DUMMY-CANNOT_BE_EMPTY', + reset_link: 'DUMMY-CANNOT_BE_EMPTY', + channel:'MOBILE', + newpass: this.new_password + }; + this.wrenchService.verifyPassReset(this.postData).subscribe( + completeResetResults => { + this.completeResetResults = completeResetResults; + console.log("completeResetResults RETURN->", this.completeResetResults); + this.showAlert('Completed', 'Login with new password now'); + this.router.navigate(['login']); + } + ); + } + showAlert(mtitle: string, amessage: string) { + /* let alert = this.alertCtrl.create({ + title: mtitle, + subTitle: amessage, + buttons: ['OK'] + }); + alert.present();*/ + alert(amessage); } - }