[Rails] Re: How to disable has_secure_password validation when a condition is true?

2014-04-18 Thread emerson mauricio freitas de moura
The solution is as follows: remove has_secure_password and use traditional method validates_confirmation_of :password, :unless = :facebook_user? validates_presence_of :password_digest, :unless = :facebook_user? def facebook_user? not uid.nil? and not provider.nil? end Em

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2014-04-18 Thread emerson mauricio freitas de moura
*Sorry, missed some details. The complete solution follows* * has_secure_password(validations: false)* * validates_confirmation_of :password, :if = :password_present?* * validates_presence_of :password, :on = :create, :unless = :facebook_user?* Em quinta-feira, 17 de abril de 2014

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-07-18 Thread Mark
I also have dual login types (ldap and manual, the latter using has_secure_password) and had the same problem. It might seem like a hack but the simple solution was to just set a bogus password for the ldap users (in the create method in my controller). I don't see any security problem with this

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-05-29 Thread bleakwood
This does not work with has_secure_password because this module automatically adds this validation: validates_presence_of :password_digest so no matter how you change the condition of validation in your own model it just doesnt work. The solution I can think of is to write your own

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-04-05 Thread YogiZoli
Hi, I haven't tried it but would go for this: http://guides.rubyonrails.org/active_record_validations_callbacks.html#conditional-validation You probably didn't used right conditions. To figure it out I always use Rails console. Create 2 users, a FB and a nonFB and try them out. On Apr 3, 7:57 

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-04-03 Thread IAmNan
Did you ever get a solution to this? My app also allows authentication outside without the password. On Feb 15, 9:23 pm, David M idav...@gmail.com wrote: Yes, I already watched those screencasts, but I still don't know how to do it. -- You received this message because you are subscribed to

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-02-15 Thread soldier.coder
Go to RailsCasts.com and read about OmniAuth with devise. Episodes #235, and #236 I would totally recommend you subscribe to his site, by the way. SC On Feb 15, 11:45 am, David M idav...@gmail.com wrote: I have a User model that can save two types of users:    1. Password-protected users

[Rails] Re: How to disable has_secure_password validation when a condition is true?

2012-02-15 Thread David M
Yes, I already watched those screencasts, but I still don't know how to do it. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9Rs7X6hHl20J. To