essai fix bug connection
This commit is contained in:
@@ -43,36 +43,37 @@ class Connect extends CI_Controller {
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
|
||||
$this->form_validation->set_rules('password', 'Password', 'required');
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
|
||||
$this->form_validation->set_rules('password', 'Password', 'required');
|
||||
|
||||
if ($this->form_validation->run() === FALSE) {
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('login');
|
||||
$this->load->view('layout/footer');
|
||||
if ($this->form_validation->run() === FALSE) {
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('login');
|
||||
$this->load->view('layout/footer');
|
||||
} else {
|
||||
$email = $this->input->post('email');
|
||||
$password = $this->input->post('password');
|
||||
|
||||
$user = $this->User_model->get_user_by_email($email);
|
||||
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$this->session->set_userdata([
|
||||
'user_id' => $user['id'],
|
||||
'email' => $user['email'],
|
||||
'logged_in' => TRUE
|
||||
]);
|
||||
redirect('albums/index');
|
||||
} else {
|
||||
$email = $this->input->post('email');
|
||||
$password = $this->input->post('password');
|
||||
|
||||
$user = $this->User_model->get_user_by_email($email);
|
||||
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$this->session->set_userdata([
|
||||
'user_id' => $user['id'],
|
||||
'email' => $user['email'],
|
||||
'logged_in' => TRUE
|
||||
]);
|
||||
redirect('albums/index');
|
||||
} else {
|
||||
$data['error'] = 'Adresse email ou mot de passe incorrect';
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('login', $data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
$data['error'] = 'Adresse email ou mot de passe incorrect';
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('login', $data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function logout()
|
||||
{
|
||||
|
Reference in New Issue
Block a user