add auth service

This commit is contained in:
David Rodenkirchen
2024-06-03 09:05:02 +02:00
parent ff2afb4a2d
commit 85f7364ed8
4 changed files with 210 additions and 1 deletions
+7 -1
View File
@@ -8,6 +8,7 @@ from from_root import from_root
from . import pages
from . import components as comps
from . import services
from .services import AuthenticationStatus
rio.Icon.register_single_icon(
set_name="custom",
@@ -105,10 +106,15 @@ themes = [
async def on_session_start(s: rio.Session) -> None:
s.authentication_status = AuthenticationStatus(None, None)
await s.set_title("EZ GG e.V.")
# Create the Rio app
database_service = services.DatabaseService()
authentication_service = services.FileBasedAuthenticationService(
from_root("pw.txt"),
raise_broken_entries=False
)
app = rio.App(
name='ezgg-website',
pages=[
@@ -157,7 +163,7 @@ app = rio.App(
icon=from_root("ezgg_website/assets/icons/favicon.png"),
assets_dir=Path(__file__).parent / "assets",
on_session_start=on_session_start,
default_attachments=[database_service],
default_attachments=[database_service, authentication_service],
meta_tags={
# "content-Type": "text/html; utf-8", # Temporarily disabled until "http-equiv" is supported by Rio
# "Pragma": "cache", # Temporarily disabled until "http-equiv" is supported by Rio