forked from External/greenlight
Redirecting the user to the referrer on login success/fail (#374)
This commit is contained in:
parent
a0036e244b
commit
404134aa8d
|
@ -29,13 +29,19 @@ class SessionsController < ApplicationController
|
|||
def create
|
||||
user = User.find_by(email: session_params[:email])
|
||||
if user && !user.greenlight_account?
|
||||
redirect_to root_path, alert: I18n.t("invalid_login_method")
|
||||
if request.referrer.present?
|
||||
redirect_to request.referrer, alert: I18n.t("invalid_login_method")
|
||||
else
|
||||
redirect_to root_path, alert: I18n.t("invalid_login_method")
|
||||
end
|
||||
elsif user.try(:authenticate, session_params[:password])
|
||||
if user.email_verified
|
||||
login(user)
|
||||
else
|
||||
redirect_to(account_activation_path(email: user.email)) && return
|
||||
end
|
||||
elsif request.referrer.present?
|
||||
redirect_to request.referrer, alert: I18n.t("invalid_credentials")
|
||||
else
|
||||
redirect_to root_path, alert: I18n.t("invalid_credentials")
|
||||
end
|
||||
|
|
|
@ -32,7 +32,11 @@ module SessionsHelper
|
|||
# If email verification is disabled, or the user has verified, go to their room
|
||||
def check_email_verified(user)
|
||||
if !Rails.configuration.enable_email_verification || user.email_verified
|
||||
redirect_to user.main_room
|
||||
if request.referrer.present?
|
||||
redirect_to request.referrer
|
||||
else
|
||||
redirect_to user.main_room
|
||||
end
|
||||
else
|
||||
redirect_to resend_path
|
||||
end
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<%= render 'shared/flash_messages' unless flash.empty? %>
|
||||
|
||||
<%= render 'shared/room_event' do %>
|
||||
<%= form_for room_path(@room), method: :post do |f| %>
|
||||
<div class="input-group join-input">
|
||||
|
|
Loading…
Reference in New Issue