Browse Source

Add change password button

pull/1793/head
tux3 10 years ago
parent
commit
67e85b3ddc
  1. 1
      src/profile.cpp
  2. 7
      src/widget/form/profileform.cpp
  3. 4
      src/widget/form/profileform.ui
  4. 16
      src/widget/form/setpassworddialog.cpp

1
src/profile.cpp

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
#include "src/historykeeper.h"
#include "src/widget/gui.h"
#include "src/widget/widget.h"
#include "src/widget/form/setpassworddialog.h"
#include "src/nexus.h"
#include <cassert>
#include <QDir>

7
src/widget/form/profileform.cpp

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
#include "ui_mainwindow.h"
#include "src/widget/form/settingswidget.h"
#include "src/widget/maskablepixmapwidget.h"
#include "src/widget/form/setpassworddialog.h"
#include "src/misc/settings.h"
#include "src/widget/croppinglabel.h"
#include "src/widget/widget.h"
@ -327,5 +328,11 @@ void ProfileForm::onDeletePassClicked() @@ -327,5 +328,11 @@ void ProfileForm::onDeletePassClicked()
void ProfileForm::onChangePassClicked()
{
SetPasswordDialog* dialog = new SetPasswordDialog(tr("Please enter a new password."), QString(), 0);
int r = dialog->exec();
if (r == QDialog::Rejected)
return;
QString newPass = dialog->getPassword();
Nexus::getProfile()->setPassword(newPass);
}

4
src/widget/form/profileform.ui

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>-41</x>
<x>0</x>
<y>0</y>
<width>630</width>
<height>625</height>
@ -252,7 +252,7 @@ Profile does not contain your history.</string> @@ -252,7 +252,7 @@ Profile does not contain your history.</string>
<item>
<widget class="QPushButton" name="deletePassButton">
<property name="text">
<string>Delete password</string>
<string>Remove password</string>
</property>
</widget>
</item>

16
src/widget/form/setpassworddialog.cpp

@ -48,15 +48,21 @@ void SetPasswordDialog::onPasswordEdit() @@ -48,15 +48,21 @@ void SetPasswordDialog::onPasswordEdit()
{
QString pswd = ui->passwordlineEdit->text();
if (pswd == ui->repasswordlineEdit->text() && pswd.length() > 0)
if (pswd.length() < 6)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui->body->setText(body);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->body->setText(body + tr("The password is too short"));
}
else
else if (pswd != ui->repasswordlineEdit->text())
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->body->setText(body + tr("The passwords don't match."));
ui->body->setText(body + tr("The password doesn't match."));
}
else
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui->body->setText(body);
}
// Password strength calculator

Loading…
Cancel
Save