Is it possible to have AuthLogic validate a password confirmation if present, but otherwise ignore it? So, if my params are as following I’d like a failure:
{ user: { password: "abcd", password_confirmation: "defg" }
However if the parameters are instead as following I’d like a success:
{ user: { password: "abcdefgh" } }
Thanks!
it’s not an AuthLogic’s matter, this code should do the trick:
then call this method from controller when you need to update attributes on User. If User did not specify a password_confirmation, it will be ignored.
you can use several other techniques to get same effect, for example, using the before_validation(:on => :update) callback.
UPDATE: if you want to skip password validations at all, acts_as_authentic accepts a block to customize its behaviour:
this is a bit un-documented 😛 check this file:
https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/acts_as_authentic/password.rb