Commit e3b70dd7 authored by Samer Afach's avatar Samer Afach

Shortcut change and confirmation of encryption password.

parent d3861235
......@@ -123,14 +123,26 @@ class AuthenticatorGUI(QMainWindow):
QMessageBox.warning(self, "Unable to read data", "Unable to read data. " + str(e))
def save_data(self, data_file):
pass_from_dialog = QInputDialog.getText(self, "Input encryption password",
pass_from_dialog_1 = QInputDialog.getText(self, "Input encryption password",
"New encryption password:",
QLineEdit.Password, "")
ok_pressed = pass_from_dialog[1]
if not ok_pressed:
ok_pressed_1 = pass_from_dialog_1[1]
if not ok_pressed_1:
return
pass_from_dialog_2 = QInputDialog.getText(self, "Repeat encryption password",
"Repeat encryption password:",
QLineEdit.Password, "")
ok_pressed_2 = pass_from_dialog_2[1]
if not ok_pressed_2:
return
if pass_from_dialog_1[0] != pass_from_dialog_2[0]:
QMessageBox.warning(self, "Error", "Password mismatch. Please try again")
self.save_data(data_file)
return
password = pass_from_dialog[0]
password = pass_from_dialog_1[0]
if self.keys_data_model is not None:
auth.write_keys_to_file(self.keys_data_model.getKeysObject(), password, data_file)
......@@ -194,8 +206,8 @@ class AuthenticatorGUI(QMainWindow):
current_path = os.path.dirname(os.path.abspath(__file__))
toolbar.addWidget(left_spacer)
add_act = QAction(QIcon(os.path.join(current_path, "images/add.png")), "Add new key", self)
add_act.setShortcut('Ctrl+A')
add_act = QAction(QIcon(os.path.join(current_path, "images/add.png")), "Add new key (Ctrl+N)", self)
add_act.setShortcut('Ctrl+N')
toolbar.addAction(add_act)
remove_act = QAction(QIcon(os.path.join(current_path, "images/delete.png")), "Remove selected key", self)
remove_act.setShortcut('Ctrl+D')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment