mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Add change password button
This commit is contained in:
parent
0642c1b0d7
commit
67e85b3ddc
|
@ -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>
|
||||
|
|
|
@ -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()
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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>
|
|||
<item>
|
||||
<widget class="QPushButton" name="deletePassButton">
|
||||
<property name="text">
|
||||
<string>Delete password</string>
|
||||
<string>Remove password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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 if (pswd != ui->repasswordlineEdit->text())
|
||||
{
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
ui->body->setText(body + tr("The password doesn't match."));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
ui->body->setText(body + tr("The passwords don't match."));
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
ui->body->setText(body);
|
||||
}
|
||||
|
||||
// Password strength calculator
|
||||
|
|
Loading…
Reference in New Issue
Block a user