diff --git a/application/modules/Auth/controllers/Auth.php b/application/modules/Auth/controllers/Auth.php index 509556d..1b401d0 100644 --- a/application/modules/Auth/controllers/Auth.php +++ b/application/modules/Auth/controllers/Auth.php @@ -26,8 +26,10 @@ public function __construct() // To inherit directly the attributes of the parent class. parent::__construct(); $this->load->model('auth_model'); + $this->load->model('MY_Model'); } + /** * [index description] * @@ -131,4 +133,65 @@ public function logout() $this->auth_model->logout(); redirect('login'); } + + public function lost_your_password() + { + $this->layout->load_view("auth/otp_verification"); + } + + public function send__mail(){ + // otp generator + $otp = rand ( 1000 , 9999 ); + $data['otp'] = $otp; + $mail = $this->input->post('email'); + $user = $this->auth_model->validate_user(); + if (empty($user)) { + $data['csrf_hash'] = $this->security->get_csrf_hash(); + $data['status'] = "failed"; + echo json_encode($data); + } + else{ + // $to = "suseendhiran1999@gmail.com"; // $mail + // $subject = "OTP"; + // $message = $otp; + // $success_msg = $this->auth_model->send_email($to, $subject, $message); + $data['csrf_hash'] = $this->security->get_csrf_hash(); + $data['status'] = "success"; + $data['id'] = $user->id; + echo json_encode($data); + } + } + + public function verify_otp(){ + $generate_otp = $this->input->post('hidden_otp'); + $user_entered_otp = $this->input->post('otp'); + $id = $this->input->post('id'); + if ($generate_otp == $user_entered_otp) + { + $data['generate_otp'] = $generate_otp; + $data['user_entered_otp'] = $user_entered_otp; + $data['csrf_hash'] = $this->security->get_csrf_hash(); + $data['status'] = "success"; + $data['id'] = $id; + $htmlPage = $this->load->view('change_password_form.php',$data,true); + $data['htmlPage'] = $htmlPage; + echo json_encode($data); + } + else + { + $data['csrf_hash'] = $this->security->get_csrf_hash(); + $data['status'] = "failed"; + echo json_encode($data); + } + } + + + public function change_password() + { + $id = $this->input->post('id'); + $data['password'] = hash_password($this->input->post('password')); + $table="users"; + $userData = $this->MY_Model->edit_option($data, $id, $table); + redirect('login'); + } } diff --git a/application/modules/Auth/views/change_password_form.php b/application/modules/Auth/views/change_password_form.php new file mode 100644 index 0000000..7877eb4 --- /dev/null +++ b/application/modules/Auth/views/change_password_form.php @@ -0,0 +1,102 @@ + + + + + + + + + + + + AMS + + + + + + + + + + + + + + + +
+
+ + + +
+
+ + \ No newline at end of file diff --git a/application/modules/Auth/views/login.php b/application/modules/Auth/views/login.php index 7732a3c..b554ba0 100644 --- a/application/modules/Auth/views/login.php +++ b/application/modules/Auth/views/login.php @@ -39,25 +39,19 @@
- session->flashdata('msg')) { - ?> -

session->flashdata('msg'); ?>

- +

session->flashdata('msg'); ?>

- + Lost your password?
- + + Create Account +


@@ -82,7 +76,6 @@
-
@@ -100,13 +93,15 @@
-

Venba Infotech!

-

©2016 All Rights Reserved. Venba Infotech! is a Bootstrap 4 template. Privacy and Terms

+

Gentelella Alela!

+

©2016 All Rights Reserved. Gentelella Alela! is a Bootstrap 4 template. Privacy and Terms

+ + diff --git a/application/modules/Auth/views/otp_verification.php b/application/modules/Auth/views/otp_verification.php new file mode 100644 index 0000000..b058e36 --- /dev/null +++ b/application/modules/Auth/views/otp_verification.php @@ -0,0 +1,174 @@ + + + + + + + + + + + + AMS + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + + \ No newline at end of file diff --git a/application/modules/User/controllers/User.php b/application/modules/User/controllers/User.php index 336f8d2..8cc5691 100644 --- a/application/modules/User/controllers/User.php +++ b/application/modules/User/controllers/User.php @@ -195,39 +195,4 @@ public function businessProfile($business_id) $this->layout->render('default_layout'); } - // public function editprofile($id) - // { - // $usertData = $this->user_model->get_user_by_md5_id($id,user()->business_id); - // $this->layout->set('editData', $usertData); - // $this->layout->buffer('main_content', 'User/edit_profile'); - // $this->layout->render('default_layout'); - // } - - // public function editprofiles() - // { - // $table="users"; - // $action = $this->input->post(); - - // $id = $this->input->post('id'); - // //file upload confic - // $user_image['upload_path'] = APPPATH. '../assets/uploads/profile_picture'; - // $user_image['allowed_types'] = 'jpg|png'; - // $user_image['max_size'] = 80000; - // //upload - // $this->load->library('upload', $user_image); - // $this->upload->initialize($user_image); - // if ( ! $this->upload->do_upload('profile_image')) - // { - // $error = array('error' => $this->upload->display_errors()); - - // unset($action['profile_image']); - // } else{ - // $upload_user_image = $this->upload->data(); - // $action['profile_image'] = $upload_user_image['file_name']; - - // } - - // $userData = $this->MY_Model->edit_option($action, $id, $table); - // redirect('user/profile'); - // } } diff --git a/assets/default/customize/ajax.js b/assets/default/customize/ajax.js index c26ca14..907949c 100644 --- a/assets/default/customize/ajax.js +++ b/assets/default/customize/ajax.js @@ -240,6 +240,10 @@ $("#file_profile").change(function(){ }); }); + + + +