|
@@ -16,12 +16,12 @@ discard block |
|
|
block discarded – undo |
|
16
|
16
|
$this->header_data['page'] = "forgot_password"; |
|
17
|
17
|
|
|
18
|
18
|
//TODO (RESEARCH): Should we allow username here too? |
|
19
|
|
- $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
|
19
|
+ $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
20
|
20
|
'required' => 'Please enter your email.', |
|
21
|
21
|
'valid_email' => 'The email your entered is invalid.' |
|
22
|
22
|
)); |
|
23
|
23
|
|
|
24
|
|
- if ($this->form_validation->run() === TRUE) { |
|
|
24
|
+ if($this->form_validation->run() === TRUE) { |
|
25
|
25
|
//form is valid |
|
26
|
26
|
|
|
27
|
27
|
$identity = $this->ion_auth->where('email', $this->input->post('email'))->users()->row(); |
|
@@ -71,21 +71,21 @@ discard block |
|
|
block discarded – undo |
|
71
|
71
|
$this->header_data['page'] = "reset-password"; |
|
72
|
72
|
|
|
73
|
73
|
$user = $this->ion_auth->forgotten_password_check($code); |
|
74
|
|
- if ($user) { |
|
|
74
|
+ if($user) { |
|
75
|
75
|
//code is valid, show reset form or process reset |
|
76
|
76
|
$min_password_length = $this->config->item('min_password_length', 'ion_auth'); |
|
77
|
77
|
$max_password_length = $this->config->item('max_password_length', 'ion_auth'); |
|
78
|
|
- $this->form_validation->set_rules('new_password', "Password", 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
|
78
|
+ $this->form_validation->set_rules('new_password', "Password", 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
79
|
79
|
$this->form_validation->set_rules('new_password_confirm', "Password Confirm", 'required|matches[new_password]'); |
|
80
|
80
|
|
|
81
|
|
- if ($this->form_validation->run() === TRUE) { |
|
|
81
|
+ if($this->form_validation->run() === TRUE) { |
|
82
|
82
|
//form is valid, process the password reset request |
|
83
|
83
|
//TODO (Research): The original ion_auth auth.php sent the userid to the form, then matched it on return, is there any point to this? |
|
84
|
84
|
|
|
85
|
85
|
$identity = $user->{'email'}; |
|
86
|
86
|
$change = $this->ion_auth->reset_password($identity, $this->input->post('new_password')); |
|
87
|
87
|
|
|
88
|
|
- if ($change) { |
|
|
88
|
+ if($change) { |
|
89
|
89
|
//password changed successfully, redirect to login |
|
90
|
90
|
$this->session->set_flashdata('notices', $this->ion_auth->messages()); |
|
91
|
91
|
redirect("user/login", 'refresh'); |