initial rebuild from v1
This commit is contained in:
12
app/controllers/application_controller.rb
Normal file
12
app/controllers/application_controller.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
around_action :switch_locale
|
||||
|
||||
def switch_locale(&action)
|
||||
locale = I18n.default_locale
|
||||
I18n.with_locale(locale, &action)
|
||||
end
|
||||
|
||||
def new_session_path(_scope)
|
||||
new_user_session_path
|
||||
end
|
||||
end
|
||||
0
app/controllers/concerns/.keep
Normal file
0
app/controllers/concerns/.keep
Normal file
4
app/controllers/home_controller.rb
Normal file
4
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
||||
24
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
24
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Controller: Callback
|
||||
#
|
||||
# Description: Callback method for Bnet
|
||||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
skip_before_action :verify_authenticity_token, only: :bnet
|
||||
|
||||
def bnet
|
||||
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
|
||||
if @user.persisted?
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
set_flash_message(:notice, :success, kind: 'Bnet') if is_navigational_format?
|
||||
else
|
||||
session['devise.bnet_data'] = request.env['omniauth.auth'].except(:extra)
|
||||
redirect_to new_user_registration_url
|
||||
end
|
||||
end
|
||||
|
||||
def failure
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user