Skip to content

Commit

Permalink
add ui communication
Browse files Browse the repository at this point in the history
  • Loading branch information
jj-so committed Jul 16, 2024
1 parent 7b7cf5c commit a837575
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion nitrokeyapp/settings_tab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def rst(self, item: QTreeWidgetItem) -> None:
self.ui.btn_save.hide()

self.ui.warning_label.setText(
"Reset for FIDO2 is only possible 10secs after plugging in the device."
"Reset for FIDO2 is only possible 10 sec after plugging in the device."
)

if pintype == SettingsTabState.FidoRst:
Expand Down Expand Up @@ -377,8 +377,12 @@ def reset_pin(self, item: QTreeWidgetItem) -> None:

if pintype == SettingsTabState.FidoRst:
self.trigger_fido_reset.emit(self.data)
self.abort(item)
self.field_clear()
elif pintype == SettingsTabState.passwordsRst:
self.trigger_passwords_reset.emit(self.data)
self.abort(item)
self.field_clear()

def act_current_password_show(self) -> None:
self.set_current_password_show(self.ui.current_password.echoMode() == QLineEdit.Password) # type: ignore [attr-defined]
Expand Down
13 changes: 9 additions & 4 deletions nitrokeyapp/settings_tab/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ def run(self) -> None:
try:
with self.touch_prompt():
fido2_client.reset()
self.common_ui.info.info.emit("FIDO2 function reset successfully!")
except Exception as e:
# print(e)
# if e == "CTAP error: 0x30 - NOT_ALLOWED":
if e == 0x30:
self.trigger_error("Please replug your Nitrokey FIDO2 now!")
a = str(e)
if a == "CTAP error: 0x30 - NOT_ALLOWED":
self.common_ui.info.error.emit(
"Device connected for more than 10 sec. Re-plugging for reset!"
)
else:
self.trigger_error(f"fido2 reset failed: {e}")

Expand All @@ -209,6 +211,9 @@ def run(self) -> None:
try:
with self.touch_prompt():
secrets.reset()
self.common_ui.info.info.emit(
"PASSWORDS function reset successfully!"
)
except SecretsAppException as e:
self.trigger_error(f"Passwords reset failed: {e}")

Expand Down

0 comments on commit a837575

Please sign in to comment.