Skip to content

Commit

Permalink
check length of comment before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
jj-so committed Mar 12, 2024
1 parent 1bf14a2 commit f989ef8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nitrokeyapp/secrets_tab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def __init__(self, info_box: InfoBox, parent: Optional[QWidget] = None) -> None:
self.ui.name.textChanged.connect(self.check_credential)
self.ui.otp.textChanged.connect(self.check_credential)
self.ui.select_algorithm.currentIndexChanged.connect(self.check_credential)
self.ui.comment.textChanged.connect(self.check_credential)

self.ui.btn_refresh.pressed.connect(self.refresh_credential_list)
self.ui.is_protected.stateChanged.connect(self.refresh_credential_list)
Expand Down Expand Up @@ -628,6 +629,10 @@ def check_credential(self) -> None:
if len(self.ui.name.text()) < 3:
can_save = False

if len(self.ui.comment.text()) >= 96:
can_save = False
self.info_box.set_status("Comment is too long")

self.ui.btn_save.setEnabled(can_save)

def act_copy_line_edit(self, obj: QLineEdit) -> None:
Expand Down

0 comments on commit f989ef8

Please sign in to comment.