mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
[fix] Load modules as proper modules + typo
This commit is contained in:
parent
7a86897579
commit
2a9769f7d9
3 changed files with 21 additions and 20 deletions
|
@ -125,7 +125,7 @@ then
|
|||
|
||||
-- If all the previous cases have failed, redirect to portal
|
||||
else
|
||||
hlp.flash("info", t("please_login"))
|
||||
hlp.flash("info", hlp.t("please_login"))
|
||||
return hlp.redirect(conf.portal_url)
|
||||
end
|
||||
|
||||
|
@ -145,7 +145,7 @@ then
|
|||
end
|
||||
else
|
||||
-- Redirect to portal
|
||||
hlp.flash("fail", t("please_login_from_portal"))
|
||||
hlp.flash("fail", hlp.t("please_login_from_portal"))
|
||||
return hlp.redirect(conf.portal_url)
|
||||
end
|
||||
end
|
||||
|
@ -357,6 +357,6 @@ end
|
|||
-- The default is to protect every URL by default.
|
||||
--
|
||||
|
||||
hlp.flash("info", t("please_login"))
|
||||
hlp.flash("info", hlp.t("please_login"))
|
||||
local back_url = ngx.var.scheme .. "://" .. ngx.var.host .. ngx.var.uri .. hlp.uri_args_string()
|
||||
return hlp.redirect(conf.portal_url.."?r="..ngx.encode_base64(back_url))
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
-- This file loads the configuration from config files or default values.
|
||||
--
|
||||
|
||||
module('config', package.seeall)
|
||||
|
||||
function get_config ()
|
||||
|
||||
|
@ -84,7 +85,7 @@ function get_config ()
|
|||
conf.lang = ngx.req.get_headers()["Accept-Language"]
|
||||
|
||||
if conf.lang then
|
||||
conf.lang = string.sub(lang, 1, 2)
|
||||
conf.lang = string.sub(conf.lang, 1, 2)
|
||||
end
|
||||
|
||||
return conf
|
||||
|
|
32
helpers.lua
32
helpers.lua
|
@ -5,6 +5,7 @@
|
|||
-- a set of useful functions related to HTTP and LDAP.
|
||||
--
|
||||
|
||||
module('helpers', package.seeall)
|
||||
|
||||
-- Read a FS stored file
|
||||
function read_file(file)
|
||||
|
@ -422,22 +423,6 @@ end
|
|||
-- title, the flash notifications' content and the translated strings.
|
||||
function get_data_for(view)
|
||||
local user = ngx.var.cookie_SSOwAuthUser
|
||||
local data = {}
|
||||
|
||||
-- Pass all the translated strings to the view (to use with t_<key>)
|
||||
if conf.lang and i18n[conf.lang] then
|
||||
translate_table = i18n[conf.lang]
|
||||
else
|
||||
translate_table = i18n[conf["default_language"]]
|
||||
end
|
||||
for k, v in pairs(translate_table) do
|
||||
data["t_"..k] = v
|
||||
end
|
||||
|
||||
-- Pass flash notification content
|
||||
data['flash_fail'] = {flashs["fail"]}
|
||||
data['flash_win'] = {flashs["win"] }
|
||||
data['flash_info'] = {flashs["info"]}
|
||||
|
||||
-- For the login page we only need the page title
|
||||
if view == "login.html" then
|
||||
|
@ -478,6 +463,21 @@ function get_data_for(view)
|
|||
end
|
||||
end
|
||||
|
||||
-- Pass all the translated strings to the view (to use with t_<key>)
|
||||
if conf.lang and i18n[conf.lang] then
|
||||
translate_table = i18n[conf.lang]
|
||||
else
|
||||
translate_table = i18n[conf["default_language"]]
|
||||
end
|
||||
for k, v in pairs(translate_table) do
|
||||
data["t_"..k] = v
|
||||
end
|
||||
|
||||
-- Pass flash notification content
|
||||
data['flash_fail'] = {flashs["fail"]}
|
||||
data['flash_win'] = {flashs["win"] }
|
||||
data['flash_info'] = {flashs["info"]}
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue