Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter: lost password feature, how to implement?

A client of mine has a site running on CodeIgniter (i did not create it, and know very little about CI), and they would like to add a lost password feature, and i have no idea how to approach implementing this feature using CI. I know PHP with most of my experience with it being from WordPress.

Can someone point me in the right direction as to the best practices for implementing this kind of thing?

like image 702
Jason Miesionczek Avatar asked Dec 16 '10 13:12

Jason Miesionczek


1 Answers

This is how I'd implement it:

  • User clicks on link, "Forgot your password"
  • User types in his/her email address
  • You put a random key and temporary password in the user table
  • You send an email with a link to activate the password you set. The link has the random key
  • User clicks on link. The link should match the random string
  • You activate the password and clear the temporary password and the random string
  • User logs in and changes his password to something he wants

CI is PHP so you'd just implement it as you'd do it in any other PHP projects, except you'll be doing within controllers/models/views.

like image 183
Teej Avatar answered Sep 30 '22 16:09

Teej