Disable welcome page if the new features are enabled (#86)
* Disable welcome page if frontend injection is enabled * Make button indicate redirecting
This commit is contained in:
committed by
GitHub
parent
27de2bcf71
commit
0888ea0400
@@ -2,7 +2,7 @@
|
||||
|
||||
from aiohttp import web
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from ..helpers import get_view
|
||||
from ..helpers import get_url, get_view
|
||||
|
||||
PATH = "/auth/oidc/welcome"
|
||||
|
||||
@@ -14,10 +14,15 @@ class OIDCWelcomeView(HomeAssistantView):
|
||||
url = PATH
|
||||
name = "auth:oidc:welcome"
|
||||
|
||||
def __init__(self, name: str) -> None:
|
||||
def __init__(self, name: str, is_frontend_injection_enabled: bool) -> None:
|
||||
self.name = name
|
||||
self.is_enabled = not is_frontend_injection_enabled
|
||||
|
||||
async def get(self, _: web.Request) -> web.Response:
|
||||
"""Receive response."""
|
||||
|
||||
if not self.is_enabled:
|
||||
return web.HTTPTemporaryRedirect(get_url("/"))
|
||||
|
||||
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