ruby on rails - validating password format in Authlogic -
Authlogic has a way to validate the password format, for example at least one letter and at least one Number? To use a validates_format_of_password_options
method in the works_as_authentic
config block, it indicates that Authlogic believes that this should not interfere with anyone's users. / P>
I thought I would just put in a normal ActiveRecord validates_format_of: password
, but this means that a current_user
object is inherently illegal, As I can, plain text can not be recovered (and it will not be stored in that object even though I could!). On finding out that my current_user
is invalid, rail or athalogic (not sure that since I am quite new to both of them) for my password on my 'edit user' page Directed with a verification error. / P>
No monkey-patching is required, but not tied to any future Authlogic changes. Just add it to your user model:
validates_format_of: password ,: with => / ^ (???? =. \ d) (? =. ([az] : [AZ])) ([\ X20- \ x7E]) {6,40} $ / ,: if =>: require_password?,: Message => "A number should be between one letter and 6 and 40 characters "
Of course you can convert regex to your needs suite.
Comments
Post a Comment