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
6 7 8 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 6 def create_user_record(email, name) user_class.create(:email => email, :name => name) end |
#google_apps ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 10 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
22 23 24 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 22 def google_apps_sign_in redirect_to :google_apps end |
#user_class ⇒ Object
2 3 4 |
# File 'app/controllers/crowdint_auth/omniauth_callbacks_controller.rb', line 2 def user_class ::User end |