|
|
@ -7,11 +7,13 @@
|
|
|
|
#include "../service.h"
|
|
|
|
#include "../service.h"
|
|
|
|
#include "../emptystringvalidator.h"
|
|
|
|
#include "../emptystringvalidator.h"
|
|
|
|
#include "../samestringvalidator.h"
|
|
|
|
#include "../samestringvalidator.h"
|
|
|
|
|
|
|
|
#include <QCryptographicHash>
|
|
|
|
|
|
|
|
|
|
|
|
UserForm::UserForm(QWidget *parent) :
|
|
|
|
UserForm::UserForm(QWidget *parent) :
|
|
|
|
AutoForm<User>(parent),
|
|
|
|
AutoForm<User>(parent),
|
|
|
|
ui(new Ui::UserForm)
|
|
|
|
ui(new Ui::UserForm)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
m_passChanged = false;
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->setupUi(this);
|
|
|
|
registerBinding(ui->login);
|
|
|
|
registerBinding(ui->login);
|
|
|
|
registerBinding(ui->password);
|
|
|
|
registerBinding(ui->password);
|
|
|
@ -54,6 +56,7 @@ void UserForm::bindOtherToUi()
|
|
|
|
ui->tableWidget->setItem(i,0,ti);
|
|
|
|
ui->tableWidget->setItem(i,0,ti);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_passChanged = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool UserForm::bindOtherToData()
|
|
|
|
bool UserForm::bindOtherToData()
|
|
|
@ -66,6 +69,19 @@ bool UserForm::bindOtherToData()
|
|
|
|
this->entity()->addRole(srv.loadById(ui->tableWidget->item(i,0)->data(Qt::UserRole).toInt()));
|
|
|
|
this->entity()->addRole(srv.loadById(ui->tableWidget->item(i,0)->data(Qt::UserRole).toInt()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_passChanged){
|
|
|
|
|
|
|
|
this->entity()->setPassword(QString(QCryptographicHash::hash(ui->password->text().toUtf8(),QCryptographicHash::Sha256).toBase64()));
|
|
|
|
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UserForm::on_password_textChanged(const QString &arg1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_passChanged = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UserForm::on_retypePassword_textChanged(const QString &arg1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_passChanged = true;
|
|
|
|
|
|
|
|
}
|
|
|
|