|
|
@@ -23,11 +23,7 @@ class OmniauthCallbacksController < ApplicationController
|
|
|
@user = User.from_omniauth(request.env['omniauth.auth'])
|
|
|
|
|
|
if @user.persisted?
|
|
|
- # this will throw if @user is not activated
|
|
|
sign_in_and_redirect @user, event: :authentication
|
|
|
- # if is_navigational_format?
|
|
|
- # set_flash_message(:notice, :success, kind: 'Google')
|
|
|
- # end
|
|
|
else
|
|
|
redirect_to new_user_registration_url
|
|
|
end
|
|
|
@@ -37,11 +33,7 @@ class OmniauthCallbacksController < ApplicationController
|
|
|
@user = User.from_omniauth(request.env['omniauth.auth'])
|
|
|
|
|
|
if @user.persisted?
|
|
|
- # this will throw if @user is not activated
|
|
|
sign_in_and_redirect @user, event: :authentication
|
|
|
- # if is_navigational_format?
|
|
|
- # set_flash_message(:notice, :success, kind: 'Reddit')
|
|
|
- # end
|
|
|
else
|
|
|
redirect_to new_user_registration_url
|
|
|
end
|
|
|
@@ -51,20 +43,20 @@ class OmniauthCallbacksController < ApplicationController
|
|
|
@user = User.from_omniauth(request.env['omniauth.auth'])
|
|
|
|
|
|
if @user.persisted?
|
|
|
- # this will throw if @user is not activated
|
|
|
sign_in_and_redirect @user, event: :authentication
|
|
|
- # if is_navigational_format?
|
|
|
- # set_flash_message(:notice, :success, kind: 'Discord')
|
|
|
- # end
|
|
|
else
|
|
|
redirect_to new_user_registration_url
|
|
|
end
|
|
|
end
|
|
|
|
|
|
def sign_in_and_redirect(user, *_args)
|
|
|
+ # TODO: Log event
|
|
|
+ # TODO: Throw on unregistered/unknown user
|
|
|
+
|
|
|
# Ensure we have a new CSRF token now that user is signed in
|
|
|
cookies.delete(:_csrf_token)
|
|
|
- self.current_user = user
|
|
|
+
|
|
|
+ login(user)
|
|
|
cookies['x-csrf-token'] = {
|
|
|
value: form_authenticity_token,
|
|
|
httponly: false,
|