Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pw-manager: properly handle save-button activation during edit #202

Merged
merged 1 commit into from Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions nitrokeyapp/secrets_tab/__init__.py
Expand Up @@ -508,6 +508,8 @@ def edit_credential(self, credential: Credential) -> None:
self.ui.select_algorithm.setCurrentText(str(credential.otp))
self.ui.select_algorithm.setEnabled(True)

self.check_credential()

def act_enable_otp_edit(self) -> None:
assert self.active_credential
self.active_credential.new_secret = True
Expand All @@ -517,6 +519,8 @@ def act_enable_otp_edit(self) -> None:
self.ui.otp.setPlaceholderText("<empty>")
self.ui.otp.setText("")

self.check_credential()

@Slot()
def add_new_credential(self) -> None:
if not self.data:
Expand Down Expand Up @@ -581,8 +585,12 @@ def check_credential(self) -> None:
otp_secret = self.ui.otp.text()

algo = self.ui.select_algorithm.currentText()
if algo != "None" and not is_base32(otp_secret):
can_save = False
if self.ui.select_algorithm.isEnabled():
if algo != "None" and not is_base32(otp_secret):
can_save = False

if algo != "None" and len(otp_secret) < 1:
can_save = False

if len(self.ui.name.text()) < 3:
can_save = False
Expand Down