File: /var/www/html/pmw24/driver_settlement/old/applicationold/controllers/Recover_password_user.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Recover_password_user extends MY_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Mcommon');
}
public function index($key){
$this->forgotpassword($key);
}
public function forgotpassword($key) {
$data['key'] = $key;
$data['title'] = 'Punjabmotors';
$this->load->view('forgotpassword_user', $data);
}
public function recover_account() {
$new_password = $this->input->post('newpassword1');
$recovery_key = $this->input->post('recovery_key');
$result=$this->mcommon->check_recovery_key($recovery_key);
if($result){
$condition=array('user_id'=>$result['user_id']);
$data=array('password'=>md5($new_password),'recovery_key'=>'');
$update_result = $this->mcommon->update('master_user',$condition,$data);
if($update_result){
$response = array("status" => true, "message" => "Password Updated Successfully");
}
else{
$response = array("status" => true, "message" => "Some thing went wrong. Please try again");
}
}
else{
$response = array("status" => true, "message" => "Reset link Expired. Please try again.");
}
echo json_encode($response);
}
public function error_404() {
$data['title'] = 'DAD';
$this->load->view('error_404');
}
}