Redirect users after sign in to their desired page
This commit is contained in:
@ -127,11 +127,14 @@ class ApplicationController < ActionController::Base
|
||||
respond_to do |format|
|
||||
format.any do
|
||||
# Prevent redirect loop
|
||||
if request.url == request.referer
|
||||
if request.url == request.referer || request.referer&.match?(sign_in_path)
|
||||
redirect_to :root, alert: message
|
||||
# Redirect to main domain if the request originated from our render_host
|
||||
elsif request.path == '/' && request.host == RENDER_HOST
|
||||
redirect_to Rails.application.config.action_mailer.default_url_options, allow_other_host: true
|
||||
elsif current_user.nil? && status == :unauthorized
|
||||
session[:return_to_url] = request.fullpath if current_user.nil?
|
||||
redirect_to sign_in_path, alert: t('application.not_signed_in')
|
||||
else
|
||||
redirect_back fallback_location: :root, allow_other_host: false, alert: message
|
||||
end
|
||||
|
@ -1,5 +1,13 @@
|
||||
h1 = t('.headline')
|
||||
|
||||
.lead
|
||||
.card.border-info-subtle.mb-3
|
||||
.card-header
|
||||
i.fa-solid.fa-circle-info.text-info
|
||||
strong.text-info
|
||||
=> t('.instructors_only')
|
||||
= t('.instructors_only_explanation', application_name:)
|
||||
|
||||
= form_tag(sessions_path) do
|
||||
.mb-3
|
||||
= label_tag(:email, t('activerecord.attributes.internal_user.email'))
|
||||
|
Reference in New Issue
Block a user