From b4b714cc5d4076499f7e4c9c020830a0630a7f01 Mon Sep 17 00:00:00 2001 From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com> Date: Fri, 12 May 2023 14:33:32 +0530 Subject: [PATCH] template mail:suseendhiran --- app/Config/Routes.php | 2 + app/Controllers/Admin_controller.php | 29 ++++++ app/Controllers/Sendmail_controller.php | 19 ++-- app/Views/admin_login.php | 4 +- app/Views/forgot_password.php | 22 +++- app/Views/layout/header.php | 4 +- app/Views/member_form.php | 2 +- app/Views/member_login.php | 2 +- app/Views/profile.php | 7 +- app/Views/user_form.php | 2 +- app/Views/users_password.php | 3 +- app/Views/verification_mail_temp.php | 131 ++++++++++++++++++++++++ 12 files changed, 205 insertions(+), 22 deletions(-) create mode 100644 app/Views/verification_mail_temp.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2bb83d5..3ac43eb 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -70,6 +70,8 @@ $routes->match(['get','post'],'/credits_pack_add','Admin_controller::credits_pac $routes->match(['get','post'],'/user_password_change','Admin_controller::user_password_change'); $routes->match(['get','post'],'/user_deactivate/(:any)','Admin_controller::user_deactivate/$1'); $routes->match(['get','post'],'/user_activate/(:any)','Admin_controller::user_activate/$1'); +$routes->match(['get','post'],'/user_forgot_password','Admin_controller::user_forgot_password'); + $routes->match(['get'],'/admin_home','Dashboard::admin_home'); $routes->match(['get'],'/member_home','Dashboard::member_home'); diff --git a/app/Controllers/Admin_controller.php b/app/Controllers/Admin_controller.php index 001a426..c326dcb 100644 --- a/app/Controllers/Admin_controller.php +++ b/app/Controllers/Admin_controller.php @@ -300,5 +300,34 @@ class Admin_controller extends BaseController echo view('layout/footer'); } + + public function user_forgot_password() + { + if($this->request->getmethod() == 'get') + { + $this->session->setTempdata('user',"user",3); + return view('forgot_password.php'); + } + else if($this->request->getmethod() == 'post') + { + + $email = $this->request->getVar('email'); + $user_data = $this->UserModel->where('email', $email)->find(); + if ($user_data) + { + $otp = rand(1000 , 9999); + $this->index($this->request->getVar('email') , $otp , 2 ); + $data['status'] = 'success'; + $data['otp'] = $otp; + echo json_encode($data); + } + else + { + $data['status'] = 'failed'; + echo json_encode($data); + } + + } + } // ----------------------------------------------- } diff --git a/app/Controllers/Sendmail_controller.php b/app/Controllers/Sendmail_controller.php index a1f73d5..9deba3e 100644 --- a/app/Controllers/Sendmail_controller.php +++ b/app/Controllers/Sendmail_controller.php @@ -19,18 +19,24 @@ class Sendmail_controller extends BaseController $email->setTo($to); if ($return == 2) { - $message = $code; + $data['id'] = '2'; + $data['otp'] = $code; + $message = view('verification_mail_temp',$data); } if($return == 3) { - $message = "
username : $to
"; - $message .= "password : $code
"; - $message .= ''; + $data['id'] = '3'; + $data['username'] = $to; + $data['password'] = $code; + $data['url'] = base_url()."admin"; + $message = view('verification_mail_temp',$data); } else { - $message = 'Please click the following link to verify your email address
'; - $message .= ''; + $data['to'] = $to; + $data['code'] = $code; + $data['url'] = base_url()."/verify_email/".md5($code); + $message = view('verification_mail_temp',$data); } $email->setSubject('Verify your email address'); $email->setMessage($message); @@ -85,6 +91,7 @@ class Sendmail_controller extends BaseController public function forgot_password() { + $this->session->setTempdata('user',"member",3); if($this->request->getmethod() == 'get') { return view('forgot_password.php'); diff --git a/app/Views/admin_login.php b/app/Views/admin_login.php index 2cf9476..95f7aeb 100644 --- a/app/Views/admin_login.php +++ b/app/Views/admin_login.php @@ -87,7 +87,7 @@ @@ -102,7 +102,7 @@ diff --git a/app/Views/forgot_password.php b/app/Views/forgot_password.php index 19d89fd..771b978 100644 --- a/app/Views/forgot_password.php +++ b/app/Views/forgot_password.php @@ -46,6 +46,7 @@