Fixes + login style

This commit is contained in:
Kload 2013-10-20 18:25:24 +02:00
parent cfae7af501
commit b34c1fcc22

View file

@ -154,9 +154,9 @@ function serve(uri)
rel_path = "/login.html" rel_path = "/login.html"
end end
content = read_file(script_path.."portal/"..rel_path) content = read_file(script_path.."portal"..rel_path)
if not content then if not content then
ngx.exit(ngx.HTTP_NOT_FOUND) return ngx.exit(ngx.HTTP_NOT_FOUND)
end end
-- Extract file extension -- Extract file extension
@ -189,12 +189,12 @@ function serve(uri)
ngx.header["Cache-Control"] = "no-cache" ngx.header["Cache-Control"] = "no-cache"
ngx.say(content) ngx.say(content)
ngx.exit(ngx.HTTP_OK) return ngx.exit(ngx.HTTP_OK)
end end
function get_data_for(view) function get_data_for(view)
if view == "login.html" then if view == "login.html" then
return { flash = "Meh" } return { title = "YunoHost Login" }
end end
end end
@ -334,7 +334,10 @@ then
-- Logout -- Logout
return do_logout() return do_logout()
elseif check_cookie() or ngx.var.uri == conf["portal_path"] then elseif check_cookie()
or ngx.var.uri == conf["portal_path"]
or string.starts(ngx.var.uri, conf["portal_path"].."assets")
then
-- Serve normal portal -- Serve normal portal
return serve(ngx.var.uri) return serve(ngx.var.uri)