Class: CrowdintAuth::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- CrowdintAuth::OmniauthCallbacksController
- Defined in:
- app/controllers/crowdint_auth/omniauth_callbacks_controller.rb
Instance Method Summary collapse
- #create_user_record(email, name) ⇒ Object
- #google_apps ⇒ Object
- #google_apps_sign_in ⇒ Object
- #user_class ⇒ Object
Instance Method Details
#create_user_record(email, name) ⇒ Object
8 9 10 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 8 def create_user_record(email, name) user_class.create(:email => email, :name => name) end |
#google_apps ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 12 def google_apps auth_hash = request.env['omniauth.auth'] email = auth_hash.info['email'] user = user_class.find_by_email(email) user ||= create_user_record(email, auth_hash.info['name']) if user.persisted? sign_in_and_redirect user end end |
#google_apps_sign_in ⇒ Object
24 25 26 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 24 def google_apps_sign_in redirect_to :google_apps end |
#user_class ⇒ Object
4 5 6 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 4 def user_class ::User end |