login password verification issue solved in codeinget
<?php
if($this->input->post('loginSubmit')){
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'password', 'required');
if ($this->form_validation->run() == true) {
$con['returnType'] = 'single';
$con['conditions'] = array(
'email'=>$this->input->post('email'),
'status' => '1'
);
$checkLogin = $this->user->getRows($con); // assumes 'password' field is also returned..
if(password_verify($this->input->post('password'), $checkLogin['password']){
$this->session->set_userdata('isUserLoggedIn',TRUE);
$this->session->set_userdata('userId',$checkLogin['id']);
redirect('users/account');
}else{
$data['error_msg'] = 'Wrong email or password, please try again.';
}
}
}
?>
Reference : https://stackoverflow.com/questions/50443246/how-to-use-password-hash-for-codeigniter
if($this->input->post('loginSubmit')){
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'password', 'required');
if ($this->form_validation->run() == true) {
$con['returnType'] = 'single';
$con['conditions'] = array(
'email'=>$this->input->post('email'),
'status' => '1'
);
$checkLogin = $this->user->getRows($con); // assumes 'password' field is also returned..
if(password_verify($this->input->post('password'), $checkLogin['password']){
$this->session->set_userdata('isUserLoggedIn',TRUE);
$this->session->set_userdata('userId',$checkLogin['id']);
redirect('users/account');
}else{
$data['error_msg'] = 'Wrong email or password, please try again.';
}
}
}
?>
Reference : https://stackoverflow.com/questions/50443246/how-to-use-password-hash-for-codeigniter
Comments
Post a Comment