Forgot password? – resetting passwords with CodeIgniter

Everyone forgets their password from time to time and it's likely that a user may wish to be reminded of their password. However, we cannot send them their password as we don't have it; we are only storing a hash of it—the password isn't actually stored in the database. The user will have to reset their password; generating a new hash as they do so.

Getting ready

We want to be sure that a user has genuinely requested a new password, therefore, we're going to add a column in the register table to support this. The new column called forgot_password will contain a code which we will generate when a new password is requested; and we will check that code when the user is redirected back to the site ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.