Force set omniauth full_host for redirection

This commit is contained in:
2020-03-05 19:18:44 -05:00
parent cf464aed8d
commit 8288595b3f
4 changed files with 7 additions and 3 deletions
+1
View File
@@ -4,6 +4,7 @@ require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
@@ -10,9 +10,9 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
@user = User.find_for_oauth(request.env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => @user.provider.to_s.capitalize
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", kind: @user.provider.to_s.capitalize
sign_in @user
redirect_to user_obtain_token_path, :event => :authentication, :current_user => @user
redirect_to user_obtain_token_path, event: :authentication, current_user: @user
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
Rails.logger.error("Failed to persist user: #{@user.errors.full_messages.join(', ')}")
+2 -1
View File
@@ -46,7 +46,8 @@ Qwaiter::Application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
#NOTE: DO NOT ACTIVATE force_ssl, this causes an infinite redirect loop and is handled by nginx
#config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
+2
View File
@@ -0,0 +1,2 @@
OmniAuth.config.full_host = Rails.env.production? ? 'https://www.mozo.bar' : 'https://www.mozo.local'