Allow forcing HTTPS in URL generation (#92)
* Force HTTPS feature * Add docs
This commit is contained in:
committed by
GitHub
parent
054f0e4bca
commit
e22f960d69
@@ -14,15 +14,16 @@ class OIDCWelcomeView(HomeAssistantView):
|
||||
url = PATH
|
||||
name = "auth:oidc:welcome"
|
||||
|
||||
def __init__(self, name: str, is_frontend_injection_enabled: bool) -> None:
|
||||
def __init__(self, name: str, is_enabled: bool, force_https: bool) -> None:
|
||||
self.name = name
|
||||
self.is_enabled = not is_frontend_injection_enabled
|
||||
self.is_enabled = is_enabled
|
||||
self.force_https = force_https
|
||||
|
||||
async def get(self, _: web.Request) -> web.Response:
|
||||
"""Receive response."""
|
||||
|
||||
if not self.is_enabled:
|
||||
return web.HTTPTemporaryRedirect(get_url("/"))
|
||||
return web.HTTPTemporaryRedirect(get_url("/", self.force_https))
|
||||
|
||||
view_html = await get_view("welcome", {"name": self.name})
|
||||
return web.Response(text=view_html, content_type="text/html")
|
||||
|
||||
Reference in New Issue
Block a user