CodeIgniter Forums
reset password - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: reset password (/showthread.php?tid=54173)



reset password - El Forum - 08-27-2012

[eluser]shiva478[/eluser]
Hi

I don't know if this is the right place but I was wondering if someone could tell me how or point me in the right direction on how to reset a password using codeigniter.

I've made a login and sign up page, and when the person signs up the password is encrypted using md5.




reset password - El Forum - 08-27-2012

[eluser]shivi[/eluser]
but your question is not realy clear . after you encrypted password what do you want to do ? to give possibility to change the password . you can check with using session if user has logged . he can change his password


reset password - El Forum - 08-27-2012

[eluser]shiva478[/eluser]
there is going to be a link that says forgot password and when the user clicks the link it will take them to a page that will ask them for their email and then an email will be sent to them with a temporary password.

That's what I would like to do.


reset password - El Forum - 08-27-2012

[eluser]DarkManX[/eluser]
...


reset password - El Forum - 08-27-2012

[eluser]timmahoney[/eluser]
Are you using pre-built Authentication functionality? For example, Ion Auth or Tank Auth?


reset password - El Forum - 08-27-2012

[eluser]cerberus478[/eluser]
no i'm not


reset password - El Forum - 08-27-2012

[eluser]CroNiX[/eluser]
How would it be any different than how you create an account, except you are just updating the password field?

Form that shows fields:
-Enter EXISTING password
-Enter New Password
-Reenter New Password

Send result to controller.
Confirm the existing password matches for the current user and the 2 (new) passwords match

If they do, run MD5 on one and store the result

Code:
$data = array('password' => md5(set_value('new_password')));
$this->db
  ->where('user_id', $current_user_id)
  ->update('users', $data);

If not, display validation errors and have them do it again.

Edit: I would use something other than MD5 for hashing passwords.