Implement I Forgot My Password

Hello Friends.

I am new to Yii. I am creating a small application.

At the user login option appears comumente Forgot your password?. which prompts the user for the username and email or send you an email with instructions on how to create your new password.

yii see that the login has by default already made, but does not bring the forgot password functionality,

If anyone knows of any extension or module that you bring this to not reinvent the wheel, I researched

but there are more modules that focus on managing all roles and users and that is too

I need.

Thanks for the accessory you can give me

I rolled my own. My app has unique needs not easily met by a user mgmt extension.

Here’s the basics.

When a user requests a new password (via entering user ID, email, username, whatever you want, plus or minus security questions) you generate a unique hash and save it. Send the user an email with a link to resetpassword controller action.

The action needs to check the GET value of the string and match to DB. If they match you allow them to reset their password (and delete the key afterwards).

waitforit, than you.

To add on it, I also introduced a “unique_valid_until” column in the DB, which is also updated when the unique is issued. This way, the ‘reset my password’ link in email sent to user (for example) can have a defined lifetime.

Also, search this question on stackoverflow.com . I bet it was addressed there a lot :slight_smile: (and not in Yii context, which ensures an attention of experienced and talented people from other fields).

Yii User has forgot my password feature. You could look at how it was done in the code to give you a better idea or just use it.

Yii-User