diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e29c4c1..79f9be8 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -72,6 +72,8 @@ $routes->match(['get','post'],'/user_deactivate/(:any)','Admin_controller::user_ $routes->match(['get','post'],'/user_activate/(:any)','Admin_controller::user_activate/$1'); $routes->match(['get'],'/transactions_list/(:any)','Admin_controller::transactions_list/$1'); $routes->match(['get'],'/transactions_list','Admin_controller::transactions_list'); +$routes->match(['get','post'],'/user_forgot_password','Admin_controller::user_forgot_password'); + $routes->match(['get'],'/admin_home','Dashboard::admin_home'); diff --git a/app/Controllers/Admin_controller.php b/app/Controllers/Admin_controller.php index ede9dcd..6220970 100644 --- a/app/Controllers/Admin_controller.php +++ b/app/Controllers/Admin_controller.php @@ -303,6 +303,7 @@ class Admin_controller extends BaseController } + public function transactions_list($member_id =null) { if($member_id == 'null') @@ -332,5 +333,35 @@ class Admin_controller extends BaseController } + + 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 @@