O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required