Omniauth Identity is a great identity provide that shipped with Omniauth 1.0 it can be a bit simple at times. I wanted to add a simple terms and conditions check on signup to my registration form and this is what I came up with.
For this example I assume you already have a Omniauth Identity setup much like explained in this Railscast.
Step 1 - app/views/identities/new.html.erb
Add a checkbox to your form.
Step 2 - app/models/identity.rb
Add a attribute to your identity model and check for it to be set.
You should really only check this on create, otherwise this validation will run every time the identity gets updated, unless of course you decide to store the
conditions value in the database.
Step 3 - config/initializers/omniauth.rb
This is the one that took me the longest to figure out. You need to tell Omniauth Identity what fields to look for on signup.
In the same way you can add a user’s name and other details, though I highly recommend you don’t store those on the
Identity but on the