Skip to content

Commit

Permalink
Check for Allowed Characters in Wallet Name, close: #85
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkd-Alex committed Apr 26, 2024
1 parent b5d8db4 commit cbe8a56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/kv/meile.kv
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,15 @@ WindowManager:
text_color: get_color_from_hex("f42121")
pos_hint: {"x": .47, "center_y": .61}
font_size: "12dp"

MDLabel:
id: wallet_name_charset_warning
opacity: 0
text: "Sorry, your wallet name can contain only letters, digits and space"
theme_text_color: "Custom"
text_color: get_color_from_hex("f42121")
pos_hint: {"x": .47, "center_y": .61}
font_size: "12dp"

ClickableTextFieldRoundPass:
id: password
Expand Down
4 changes: 4 additions & 0 deletions src/ui/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def restore_wallet_from_seed_phrase(self):
wallet_password = unidecode(self.ids.password.ids.wallet_password.text)
wallet_name = unidecode(self.ids.name.ids.wallet_name.text)
seed_phrase = unidecode(self.ids.seed.ids.seed_phrase.text)

if not wallet_name and not wallet_password:
self.ids.wallet_name_warning.opacity = 1
self.ids.wallet_password_warning.opacity = 1
Expand All @@ -86,6 +87,9 @@ def restore_wallet_from_seed_phrase(self):
elif not wallet_name:
self.ids.wallet_name_warning.opacity = 1
return
elif re.match(r"^[A-Za-z0-9 ]*$", wallet_name) is None:
self.ids.wallet_name_charset_warning.opacity = 1
return
elif len(wallet_password) < 8:
self.ids.wallet_password_warning.opacity = 1
return
Expand Down

0 comments on commit cbe8a56

Please sign in to comment.