forked from External/greenlight
Redirect authenticated users to main room when accessing ldap signin (#856)
Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
parent
445800d382
commit
079d64795b
|
@ -42,7 +42,8 @@ module Authenticator
|
|||
redirect_to admins_path
|
||||
elsif user.activated?
|
||||
# Dont redirect to any of these urls
|
||||
dont_redirect_to = [root_url, signin_url, signup_url, unauthorized_url, internal_error_url, not_found_url]
|
||||
dont_redirect_to = [root_url, signin_url, ldap_signin_url, signup_url, unauthorized_url,
|
||||
internal_error_url, not_found_url]
|
||||
url = if cookies[:return_to] && !dont_redirect_to.include?(cookies[:return_to])
|
||||
cookies[:return_to]
|
||||
else
|
||||
|
|
|
@ -24,7 +24,7 @@ class SessionsController < ApplicationController
|
|||
|
||||
skip_before_action :verify_authenticity_token, only: [:omniauth, :fail]
|
||||
before_action :check_user_signup_allowed, only: [:new]
|
||||
before_action :ensure_unauthenticated_except_twitter, only: [:new, :signin]
|
||||
before_action :ensure_unauthenticated_except_twitter, only: [:new, :signin, :ldap_signin]
|
||||
|
||||
# GET /signin
|
||||
def signin
|
||||
|
|
|
@ -61,6 +61,14 @@ describe SessionsController, type: :controller do
|
|||
|
||||
expect(response).to render_template(:ldap_signin)
|
||||
end
|
||||
|
||||
it "redirects user to main room if already signed in" do
|
||||
user = create(:user)
|
||||
@request.session[:user_id] = user.id
|
||||
|
||||
post :signin
|
||||
expect(response).to redirect_to(room_path(user.main_room))
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #destroy" do
|
||||
|
|
Loading…
Reference in New Issue