document bug, implement workaround and move on

This commit is contained in:
David Rodenkirchen 2024-08-28 15:26:37 +02:00
parent 7b7e52c474
commit e9f3e78cbd

View File

@ -41,17 +41,24 @@ class UserInfoAndLoginBox(Component):
@staticmethod
def get_greeting() -> str:
return choice(["Grüße", "Hallo", "Willkommen", "Moin", "Ahoi"])
return choice(["Guten Tacho", "Tuten Gag", "Hallöchen mit Öchen", "Servus", "Moinjour", "Hallöchen Popöchen", "Heyho", "Moinsen"])
# @FixMe: If the user logs out and then tries to log back in, it does not work
# If the user navigates to another page and then tries again. It works.
# When fixed, remove the workaround below.
async def logout(self) -> None:
self.show_login = True
await self.session[SessionStorage].clear()
await self.force_refresh()
await self.refresh_cb()
# @FixMe: Workaround for the bug described above. Navigating to another page solves the issue.
# Yet, this is not desired behavior.
subpage = str(self.session.active_page_url)
if subpage.endswith("/") or subpage.endswith("news"):
self.session.navigate_to("./overview")
else:
self.session.navigate_to("./news")
async def _on_login_pressed(self) -> None:
self.login_button.is_loading = True
await self.login_button.force_refresh()
user_name = self.user_name_input.text.lower()
if self.session[UserService].is_login_valid(user_name, self.password_input.text):
self.user_name_input.is_valid = True