Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise password which allows special characters

I'm using devise gem for my rails3 project. I need to allow (!@#$%^&*-+?<>,.;:"'\|) these special characters in my password. Can any one help me how to write validation for this?

Thanks in advance.

like image 666
Kranthi Avatar asked Mar 03 '26 03:03

Kranthi


1 Answers

you can validate like this

validates_format_of :password, :with => /^[A-Za-z0-9. ! @ # $ % ^ & * ( ) _ - + = ]*\z/
like image 104
Raj Adroit Avatar answered Mar 04 '26 18:03

Raj Adroit