Welcome Guest, Not a member yet? Register   Sign In
reset password
#1

[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.

#2

[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
#3

[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.
#4

[eluser]DarkManX[/eluser]
...
#5

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

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

[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.




Theme © iAndrew 2016 - Forum software by © MyBB