0

I am using authlogic for my user login functionality in my Rails app. But authlogic allows space in password and my application doesn't require this. So how can I do it?

Thanks!

John Topley
  • 113,588
  • 46
  • 195
  • 237
gsoni
  • 1,126
  • 15
  • 25
  • It's not clear whether you are concerned with validating password formats at user creation time or at authentication time. You might find the answer to this question helpful: http://stackoverflow.com/questions/2186831/validating-password-format-in-authlogic – bjg Jul 16 '10 at 12:57

1 Answers1

0

You could use a regular expression to define your password rules.

validates_format_of :password, :with => /{regular expression here}/, :if => :require_password?, :message => "Must not contain any spaces!"
Chuck Callebs
  • 16,293
  • 8
  • 56
  • 71