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 .= '

Login here

'; + $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 .= '

Verify Email

'; + $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 @@
-

Forgot your password?

+

" class="">Forgot your password?

@@ -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 @@
+
@@ -90,7 +91,7 @@ @@ -109,16 +110,22 @@ $('#alert').delay(3000).fadeOut('slow'); $(".disable").hide(); $(document).on('click','#submit1',function(){ + $('#alert1').html('Please wait...'); var email = $("#email").val(); + var url; + var user_role = $('#user').val(); + if ($('#user').val() == 'member') { url = "forgot_password" } + else { url = "user_forgot_password" } $.ajax({ type: "post", - url: "forgot_password", + url: url, data: { email : email }, json: true, success: function(response) { response = jQuery.parseJSON(response); if (response.status == "success") { + $('#alert1').html(''); $(".disable").show(); $('#verify_otp').val(response.otp); $("#re-sub").html(''); @@ -126,8 +133,17 @@ $(document).on('click','#submit1',function(){ } else { + console.log(user_role); + $('#alert1').html(''); $('#alert1').addClass('alert alert-danger'); - $('#alert1').html('Email is not verified.please check your mail.') + if (user_role == 'member') + { + $('#alert1').html('Email is not verified.please check your mail.'); + } + else + { + $('#alert1').html('Invalid email.'); + } } diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 7f841be..82d06f6 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -252,10 +252,10 @@ $(document).ready(function(){ diff --git a/app/Views/profile.php b/app/Views/profile.php index 4cbebb5..7ce2374 100644 --- a/app/Views/profile.php +++ b/app/Views/profile.php @@ -80,7 +80,7 @@ body {
profile-image - +
Edit Profile @@ -91,7 +91,7 @@ body {
' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image"> - +
Edit Profile @@ -131,13 +131,10 @@ body {