web ui: New setting for browser-based login
This is useful in cases where OIDC login is active which would then redirect the user to a central login page. See https://github.com/Kozea/Radicale/issues/2143
This commit is contained in:
@@ -34,7 +34,27 @@ FALLBACK_MIMETYPE = httputils.FALLBACK_MIMETYPE # deprecated
|
||||
|
||||
class Web(web.BaseWeb):
|
||||
|
||||
def get(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
|
||||
user: str, request_info: dict) -> types.WSGIResponse:
|
||||
return httputils.serve_resource("radicale.web", "internal_data",
|
||||
base_prefix, path)
|
||||
def get(
|
||||
self,
|
||||
environ: types.WSGIEnviron,
|
||||
base_prefix: str,
|
||||
path: str,
|
||||
user: str,
|
||||
request_info: dict,
|
||||
) -> types.WSGIResponse:
|
||||
if path == "/.web/js/config.js":
|
||||
prefer_browser_login = (
|
||||
"true"
|
||||
if self.configuration.get("web", "prefer_browser_login")
|
||||
else "false"
|
||||
)
|
||||
content = (
|
||||
f"export const PREFER_BROWSER_LOGIN = {prefer_browser_login};\n".encode(
|
||||
"utf-8"
|
||||
)
|
||||
)
|
||||
headers = {"Content-Type": "application/javascript"}
|
||||
return 200, headers, content, None
|
||||
return httputils.serve_resource(
|
||||
"radicale.web", "internal_data", base_prefix, path
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user