title: Preventing password reuse with Devise
body: <p>I know that forcing passwords to expire after a certain period from the time the user creates them is not part of Devise logic, and I'm planning to write my own code to make that happen.</p>
  
  <p>It also looks like forcing the user not to reuse one of the last X (in my case 10) passwords will need to be coded manually.</p>
  
  <p>My thinking is that I'll create something like a user_passwords table and use logic in my code to make sure the new password doesn't match any in that table for that user. At the same time I would insert the new password into the table, unless there are 10 records for that user there already, which would mean I'd overwrite the oldest with the new value. Table structure would be something like this:</p>
  
  <p><strong>user_passwords</strong></p>
  
  <ul>
  <li>user_id</li>
  <li>encrypted_password</li>
  <li>created_at</li>
  </ul>
  
  <p>If anyone has a better, more elegant solution to handle this, I'd appreciate it. </p>