Jump to content

The ultimate community for Ruby on Rails developers.


Devise: additional validations for password changes?


  • Please log in to reply
1 reply to this topic

#1 Vell



  • Members
  • 100 posts
  • LocationWashington, DC

Posted 22 November 2013 - 07:46 PM

Hello all,


I have been tasked with updating an app to add a few more validations for users who want to update their password. I am curious if devise already has these things and they are just not documented anywhere.


Right now I am attempting to 

1. user shouldn't update their password with their current password

2. restricting password to certainly alpha numeric characters / or excluding a list of them

3. excepting spaces for a password


My first thought and research (since I didn't find anything) is that I will have to create these validations myself in the model and call it a day. But is it possible that devise has something already in place for some of these and their for I don't need to create my own?


Just wondering your thoughts

#2 stevieing



  • Members
  • 40 posts

Posted 28 November 2013 - 09:54 AM

It is pretty simple to add custom validations in devise. I am sure the first one has been done before. Checking against the current password is simple but I don't know whether Devise stores all previously used passwords to check against.


For two and three you would probably need override the current validation methods. Number 2 and 3 could be part of the same validation method but 3 could be especially complex as you would need to limit to a single space for security reasons.


Your other alternative would be to exclude the validateable module and write your own custom validation methods.



Also tagged with one or more of these keywords: devise

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users