Class: V2Users::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- V2Users::OmniauthCallbacksController
- Defined in:
- app/controllers/v2_users/omniauth_callbacks_controller.rb
Instance Method Summary collapse
- #after_omniauth_failure_path_for(_scope) ⇒ Object
- #facebook ⇒ Object
- #failure ⇒ Object
- #google_oauth2 ⇒ Object
Instance Method Details
#after_omniauth_failure_path_for(_scope) ⇒ Object
38 39 40 |
# File 'app/controllers/v2_users/omniauth_callbacks_controller.rb', line 38 def after_omniauth_failure_path_for(_scope) new_user_registration_url end |
#facebook ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/v2_users/omniauth_callbacks_controller.rb', line 7 def facebook operation = AccountCpt::Registration::RegularUser::WithFacebook.call( request.env['omniauth.auth'], ) if operation.success? # `event: :authentication` will throw if @user is not activated sign_in_and_redirect operation[OpCons::OPERATION_RESULT], event: :authentication (:notice, :success, kind: 'Facebook') if else session['devise.facebook_data'] = request.env['omniauth.auth'] alert = operation[OpCons::ERRORS]&.&.to_sentence&.presence || 'Something went wrong' redirect_to new_user_registration_url, alert: alert end end |
#failure ⇒ Object
42 43 44 |
# File 'app/controllers/v2_users/omniauth_callbacks_controller.rb', line 42 def failure redirect_to new_user_registration_url end |
#google_oauth2 ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/v2_users/omniauth_callbacks_controller.rb', line 24 def google_oauth2 operation = AccountCpt::Session::StaffUser::WithGoogle.call( request.env['omniauth.auth'] ) if operation.success? sign_in operation[OpCons::OPERATION_RESULT] redirect_to admin_root_path else alert = operation[OpCons::ERRORS]..to_sentence redirect_to new_admin_session_path, alert: alert end end |