Managing validations with authenticatable and omniauthable

9 views
Skip to first unread message

Nicholas Wieland

unread,
Sep 13, 2015, 7:00:35 AM9/13/15
to Devise
Hi *, I want to let my users register with both email-password and Facebook. In the first case I want the registration form to validate password format and confirmation plus some other validations, in the second case there's no password so I want to skip that particular validation, but I have a form similar to the registration one where users can confirm their data and points to the canonical devise create action.
Do I have to write another create action (maybe in the callbacks controller) where I force saving my user and avoid validation? Doesn't seem very clean to me. How do you solve this "problem"?

TIA, ngw

Carlos Antonio da Silva

unread,
Sep 13, 2015, 9:31:54 AM9/13/15
to Devise

There's a password_required? hook you can override in your model to tell devise to skip the password validation, you just need to manipulate that on the omni Auth case, and call super otherwise.

Carlos Antonio da Silva - via celular

--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages