Skip to content

Commit

Permalink
Commit for demo purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
kushaldas committed Jan 2, 2020
1 parent 4d71556 commit 6e39531
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
17 changes: 17 additions & 0 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,10 @@ def __init__(self, parent):
self.password_field = QLineEdit()
self.password_field.setEchoMode(QLineEdit.Password)

self.togglepasswordAction = self.password_field.addAction(QIcon(load_icon("eye_visible.svg")), QLineEdit.TrailingPosition)
self.togglepasswordAction.triggered.connect(self.on_toggle_password_Action)
self.password_shown = False

self.tfa_label = QLabel(_('Two-Factor Code'))
self.tfa_field = QLineEdit()

Expand Down Expand Up @@ -1403,6 +1407,19 @@ def __init__(self, parent):
layout.addStretch()
layout.addWidget(application_version)

def on_toggle_password_Action(self):
if not self.password_shown:
self.password_field.setEchoMode(QLineEdit.Normal)
self.password_shown = True
icon = QIcon(load_icon("eye_hidden.svg"))
self.togglepasswordAction.setIcon(icon)
else:
self.password_field.setEchoMode(QLineEdit.Password)
self.password_shown = False
icon = QIcon(load_icon("eye_visible.svg"))
self.togglepasswordAction.setIcon(icon)


def closeEvent(self, event):
"""
Only exit the application when the main window is not visible.
Expand Down
20 changes: 20 additions & 0 deletions securedrop_client/resources/images/eye_hidden.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions securedrop_client/resources/images/eye_visible.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e39531

Please sign in to comment.