mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Do not 500 when a requested domain is not configured for SSOWat
This commit is contained in:
parent
1ac6388242
commit
5fcfd9ede6
1 changed files with 9 additions and 5 deletions
14
access.lua
14
access.lua
|
@ -286,14 +286,18 @@ if has_access then
|
||||||
-- 2nd case : no access ... redirect to portal / login form
|
-- 2nd case : no access ... redirect to portal / login form
|
||||||
else
|
else
|
||||||
|
|
||||||
portal_url = "https://" .. conf["domain_portal_urls"][ngx.var.host]
|
portal_domain = conf["domain_portal_urls"][ngx.var.host]
|
||||||
logger:debug("Redirecting to portal : " .. portal_url)
|
if portal_domain == nil then
|
||||||
if portal_url == nil then
|
logger:debug("Domain " .. ngx.var.host .. " is not configured for SSOWat")
|
||||||
ngx.status = 400
|
ngx.status = 400
|
||||||
ngx.header.content_type = "plain/text"
|
ngx.header.content_type = "plain/text"
|
||||||
ngx.say('Unmanaged domain')
|
ngx.say("Unmanaged domain: " .. ngx.var.host)
|
||||||
return
|
return
|
||||||
elseif is_logged_in then
|
end
|
||||||
|
portal_url = "https://" .. portal_domain
|
||||||
|
logger:debug("Redirecting to portal : " .. portal_url)
|
||||||
|
|
||||||
|
if is_logged_in then
|
||||||
return ngx.redirect(portal_url)
|
return ngx.redirect(portal_url)
|
||||||
else
|
else
|
||||||
local back_url = "https://" .. ngx.var.host .. ngx.var.uri .. uri_args_string()
|
local back_url = "https://" .. ngx.var.host .. ngx.var.uri .. uri_args_string()
|
||||||
|
|
Loading…
Reference in a new issue