improve error messages

This commit is contained in:
David Rodenkirchen 2024-08-26 22:22:03 +02:00
parent 09d7178ea0
commit 4a6b09f41c

View File

@ -50,6 +50,7 @@ class EditProfilePage(Component):
try:
new_pfp = await self.session.file_chooser(file_extensions=("png", "jpg", "jpeg"), multiple=False)
except NoFileSelectedError:
await self.display_save_result_animation(False, optional_text="Keine Datei ausgewählt!")
return
if new_pfp.size_in_bytes > 2 * 1_000_000:
@ -86,12 +87,12 @@ class EditProfilePage(Component):
async def on_save_pressed(self) -> None:
if not all((self.email_input.is_valid, self.birthday_input.is_valid)):
await self.display_save_result_animation(False)
await self.display_save_result_animation(False, optional_text="Ungültige Werte!")
return
if len(self.new_pw_1_input.text.strip()) > 0:
if self.new_pw_1_input.text.strip() != self.new_pw_2_input.text.strip():
await self.display_save_result_animation(False)
await self.display_save_result_animation(False, optional_text="Passwörter nicht gleich!")
return
user: User = self.session[UserService].get_user(self.session[SessionStorage].user_id)