remove buggy input checks

This commit is contained in:
David Rodenkirchen 2025-03-23 21:48:44 +01:00
parent 26994d4536
commit 49d89feda3

View File

@ -13,7 +13,7 @@ logger = logging.getLogger(__name__.split(".")[-1])
class RegisterPage(Component): class RegisterPage(Component):
def on_pw_change(self, _: TextInputChangeEvent) -> None: def on_pw_focus_loss(self, _: TextInputChangeEvent) -> None:
if not (self.pw_1.text == self.pw_2.text) or len(self.pw_1.text) < MINIMUM_PASSWORD_LENGTH: if not (self.pw_1.text == self.pw_2.text) or len(self.pw_1.text) < MINIMUM_PASSWORD_LENGTH:
self.pw_1.is_valid = False self.pw_1.is_valid = False
self.pw_2.is_valid = False self.pw_2.is_valid = False
@ -21,14 +21,14 @@ class RegisterPage(Component):
self.pw_1.is_valid = True self.pw_1.is_valid = True
self.pw_2.is_valid = True self.pw_2.is_valid = True
def on_email_changed(self, change_event: TextInputChangeEvent) -> None: def on_email_focus_loss(self, change_event: TextInputChangeEvent) -> None:
try: try:
validate_email(change_event.text, check_deliverability=False) validate_email(change_event.text, check_deliverability=False)
self.email_input.is_valid = True self.email_input.is_valid = True
except EmailNotValidError: except EmailNotValidError:
self.email_input.is_valid = False self.email_input.is_valid = False
def on_user_name_input_change(self, _: TextInputChangeEvent) -> None: def on_user_name_focus_loss(self, _: TextInputChangeEvent) -> None:
current_text = self.user_name_input.text current_text = self.user_name_input.text
if len(current_text) > UserService.MAX_USERNAME_LENGTH: if len(current_text) > UserService.MAX_USERNAME_LENGTH:
self.user_name_input.text = current_text[:UserService.MAX_USERNAME_LENGTH] self.user_name_input.text = current_text[:UserService.MAX_USERNAME_LENGTH]
@ -100,7 +100,7 @@ class RegisterPage(Component):
margin_right=1, margin_right=1,
margin_bottom=1, margin_bottom=1,
grow_x=True, grow_x=True,
on_change=self.on_user_name_input_change on_lose_focus=self.on_user_name_focus_loss
) )
self.email_input = TextInput( self.email_input = TextInput(
label="E-Mail Adresse", label="E-Mail Adresse",
@ -109,7 +109,7 @@ class RegisterPage(Component):
margin_right=1, margin_right=1,
margin_bottom=1, margin_bottom=1,
grow_x=True, grow_x=True,
on_change=self.on_email_changed on_lose_focus=self.on_email_focus_loss
) )
self.pw_1 = TextInput( self.pw_1 = TextInput(
label="Passwort", label="Passwort",
@ -119,7 +119,7 @@ class RegisterPage(Component):
margin_bottom=1, margin_bottom=1,
grow_x=True, grow_x=True,
is_secret=True, is_secret=True,
on_change=self.on_pw_change on_lose_focus=self.on_pw_focus_loss
) )
self.pw_2 = TextInput( self.pw_2 = TextInput(
label="Passwort wiederholen", label="Passwort wiederholen",
@ -129,7 +129,7 @@ class RegisterPage(Component):
margin_bottom=1, margin_bottom=1,
grow_x=True, grow_x=True,
is_secret=True, is_secret=True,
on_change=self.on_pw_change on_lose_focus=self.on_pw_focus_loss
) )
self.submit_button = Button( self.submit_button = Button(
content=Text( content=Text(