mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge #11480: [ui] Add toggle for unblinding password fields
ff35de8
[ui] Add toggle for unblinding password fields (Thomas Snider)
Pull request description:
Proposed change for adding the ability to toggle password visibility in the password dialog. This is similar to functionality in most password managers and is specifically added with the use case of password managers in mind - the password in that case is likely pasted twice into both the new password and confirm password fields.
If this is a welcome change, I am open to suggestions on rearranging the layout.
Tree-SHA512: 1823f356f8f941cc584c44de264433e9a573cb8a358efa300a412c4458b5564d8d193969be40859195cf9c8d6768eee895ee22440d51db4f09175f9b4e28bced
This commit is contained in:
commit
ffc0b11503
@ -70,6 +70,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) :
|
||||
break;
|
||||
}
|
||||
textChanged();
|
||||
connect(ui->toggleShowPasswordButton, SIGNAL(toggled(bool)), this, SLOT(toggleShowPassword(bool)));
|
||||
connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
@ -234,6 +235,15 @@ bool AskPassphraseDialog::event(QEvent *event)
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void AskPassphraseDialog::toggleShowPassword(bool show)
|
||||
{
|
||||
ui->toggleShowPasswordButton->setDown(show);
|
||||
const auto mode = show ? QLineEdit::Normal : QLineEdit::Password;
|
||||
ui->passEdit1->setEchoMode(mode);
|
||||
ui->passEdit2->setEchoMode(mode);
|
||||
ui->passEdit3->setEchoMode(mode);
|
||||
}
|
||||
|
||||
bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
/* Detect Caps Lock.
|
||||
|
@ -43,6 +43,7 @@ private:
|
||||
private Q_SLOTS:
|
||||
void textChanged();
|
||||
void secureClearPassFields();
|
||||
void toggleShowPassword(bool);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
@ -93,6 +93,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="toggleShowPasswordButton">
|
||||
<property name="text">
|
||||
<string>Show password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="capsLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
Loading…
Reference in New Issue
Block a user