mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Изменение пароля
This commit is contained in:
14
InstructorsAndTrainees/dialognewpassword.cpp
Normal file
14
InstructorsAndTrainees/dialognewpassword.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "dialognewpassword.h"
|
||||||
|
#include "ui_dialognewpassword.h"
|
||||||
|
|
||||||
|
DialogNewPassword::DialogNewPassword(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::DialogNewPassword)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogNewPassword::~DialogNewPassword()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
22
InstructorsAndTrainees/dialognewpassword.h
Normal file
22
InstructorsAndTrainees/dialognewpassword.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef DIALOGNEWPASSWORD_H
|
||||||
|
#define DIALOGNEWPASSWORD_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DialogNewPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogNewPassword : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DialogNewPassword(QWidget *parent = nullptr);
|
||||||
|
~DialogNewPassword();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::DialogNewPassword *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGNEWPASSWORD_H
|
||||||
38
InstructorsAndTrainees/dialognewpassword.ui
Normal file
38
InstructorsAndTrainees/dialognewpassword.ui
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogNewPassword</class>
|
||||||
|
<widget class="QDialog" name="DialogNewPassword">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>277</width>
|
||||||
|
<height>95</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="editPassword1"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="editPassword2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnOK">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
#include "dialogeditinstructor.h"
|
#include "dialogeditinstructor.h"
|
||||||
#include "ui_dialogeditinstructor.h"
|
#include "ui_dialogeditinstructor.h"
|
||||||
|
#include "hashtools.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
|
|
||||||
DialogEditInstructor::DialogEditInstructor(QWidget *parent) :
|
DialogEditInstructor::DialogEditInstructor(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DialogEditInstructor),
|
ui(new Ui::DialogEditInstructor),
|
||||||
instructorInput()
|
instructorInput(),
|
||||||
|
flNeedHashPassword(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
verify();
|
verify();
|
||||||
@@ -16,15 +18,17 @@ DialogEditInstructor::DialogEditInstructor(QWidget *parent) :
|
|||||||
ui->editPassword->setProperty("mandatoryField", true);
|
ui->editPassword->setProperty("mandatoryField", true);
|
||||||
|
|
||||||
ui->btnViewPassword->setObjectName("btnViewPassword");
|
ui->btnViewPassword->setObjectName("btnViewPassword");
|
||||||
|
ui->btnChangePassword->setObjectName("btnChangePassword");
|
||||||
|
|
||||||
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
|
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
|
||||||
|
|
||||||
ui->editPassword->setEnabled(false);
|
ui->editPassword->setEnabled(false);
|
||||||
//#ifndef PROJECT_TYPE_DEBUG
|
#ifndef PROJECT_TYPE_DEBUG
|
||||||
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
ui->btnViewPassword->setEnabled(false);
|
ui->btnViewPassword->setEnabled(false);
|
||||||
|
ui->btnChangePassword->setEnabled(false);
|
||||||
|
|
||||||
ui->btnOK->setEnabled(false);
|
ui->btnOK->setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -56,8 +60,8 @@ void DialogEditInstructor::setInstructor(Instructor instructor)
|
|||||||
ui->editPassword->setEnabled(true);
|
ui->editPassword->setEnabled(true);
|
||||||
ui->btnViewPassword->setEnabled(true);
|
ui->btnViewPassword->setEnabled(true);
|
||||||
}
|
}
|
||||||
//else
|
else
|
||||||
//ui->editPassword->setText("*****");
|
ui->btnChangePassword->setEnabled(true);
|
||||||
|
|
||||||
ui->btnOK->setEnabled(false);
|
ui->btnOK->setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -68,7 +72,15 @@ Instructor DialogEditInstructor::getInstructor()
|
|||||||
|
|
||||||
instructor.setName(ui->editName->text());
|
instructor.setName(ui->editName->text());
|
||||||
instructor.setLogin(ui->editLogin->text());
|
instructor.setLogin(ui->editLogin->text());
|
||||||
instructor.setPassword(ui->editPassword->text());
|
|
||||||
|
if(flNeedHashPassword)
|
||||||
|
{
|
||||||
|
QString psw = ui->editPassword->text();
|
||||||
|
psw = HashTools::hashingMD5string(psw);
|
||||||
|
instructor.setPassword(psw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
instructor.setPassword(ui->editPassword->text());
|
||||||
|
|
||||||
instructor.setIsAdmin(ui->checkIsAdmin->isChecked());
|
instructor.setIsAdmin(ui->checkIsAdmin->isChecked());
|
||||||
instructor.setArchived(ui->checkArchived->isChecked());
|
instructor.setArchived(ui->checkArchived->isChecked());
|
||||||
@@ -116,3 +128,12 @@ void DialogEditInstructor::on_btnViewPassword_released()
|
|||||||
{
|
{
|
||||||
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogEditInstructor::on_btnChangePassword_clicked()
|
||||||
|
{
|
||||||
|
ui->editPassword->setEnabled(true);
|
||||||
|
ui->btnViewPassword->setEnabled(true);
|
||||||
|
|
||||||
|
ui->editPassword->setText("");
|
||||||
|
flNeedHashPassword = true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ private slots:
|
|||||||
|
|
||||||
void on_btnViewPassword_released();
|
void on_btnViewPassword_released();
|
||||||
|
|
||||||
|
void on_btnChangePassword_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void verify();
|
void verify();
|
||||||
|
|
||||||
@@ -40,6 +42,8 @@ private:
|
|||||||
Ui::DialogEditInstructor *ui;
|
Ui::DialogEditInstructor *ui;
|
||||||
|
|
||||||
Instructor instructorInput;
|
Instructor instructorInput;
|
||||||
|
|
||||||
|
bool flNeedHashPassword;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGEDITINSTRUCTOR_H
|
#endif // DIALOGEDITINSTRUCTOR_H
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>300</width>
|
<width>470</width>
|
||||||
<height>286</height>
|
<height>286</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -98,6 +98,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnChangePassword">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/resources/icons/exchange.png</normaloff>:/resources/icons/exchange.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -54,5 +54,6 @@
|
|||||||
<file>resources/icons/info.png</file>
|
<file>resources/icons/info.png</file>
|
||||||
<file>resources/icons/personalCard.png</file>
|
<file>resources/icons/personalCard.png</file>
|
||||||
<file>resources/icons/eye.png</file>
|
<file>resources/icons/eye.png</file>
|
||||||
|
<file>resources/icons/exchange.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -87,6 +87,13 @@ QToolButton#btnAssignTask {
|
|||||||
width: 80px;
|
width: 80px;
|
||||||
height: 55px;
|
height: 55px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QToolButton#btnViewPassword, QToolButton#btnChangePassword {
|
||||||
|
min-width: 18px;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
QPushButton:flat, QToolButton:flat {
|
QPushButton:flat, QToolButton:flat {
|
||||||
border: none; /* no border for a flat push button */
|
border: none; /* no border for a flat push button */
|
||||||
}
|
}
|
||||||
@@ -286,7 +293,6 @@ QTextEdit#editMsg {
|
|||||||
height: 65px; /**/
|
height: 65px; /**/
|
||||||
background: #ddeeff;
|
background: #ddeeff;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
|
||||||
}
|
}
|
||||||
QTextEdit#MsgWidgetEditTextLocal {
|
QTextEdit#MsgWidgetEditTextLocal {
|
||||||
/*background: tlightgreen;*/
|
/*background: tlightgreen;*/
|
||||||
@@ -337,6 +343,12 @@ QLabel#MessangerWidgetLblLoggedIn {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QLabel#PersonalCard_lblName {
|
||||||
|
font-size: 16pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget#widgetControl {
|
QWidget#widgetControl {
|
||||||
background: #E0E0E0;
|
background: #E0E0E0;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
InstructorsAndTrainees/resources/icons/exchange.png
Normal file
BIN
InstructorsAndTrainees/resources/icons/exchange.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -1,12 +1,14 @@
|
|||||||
#include "dialogedittrainee.h"
|
#include "dialogedittrainee.h"
|
||||||
#include "ui_dialogedittrainee.h"
|
#include "ui_dialogedittrainee.h"
|
||||||
|
#include "hashtools.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
|
|
||||||
DialogEditTrainee::DialogEditTrainee(QWidget *parent) :
|
DialogEditTrainee::DialogEditTrainee(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DialogEditTrainee),
|
ui(new Ui::DialogEditTrainee),
|
||||||
traineeInput()
|
traineeInput(),
|
||||||
|
flNeedHashPassword(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
verify();
|
verify();
|
||||||
@@ -16,15 +18,17 @@ DialogEditTrainee::DialogEditTrainee(QWidget *parent) :
|
|||||||
ui->editPassword->setProperty("mandatoryField", true);
|
ui->editPassword->setProperty("mandatoryField", true);
|
||||||
|
|
||||||
ui->btnViewPassword->setObjectName("btnViewPassword");
|
ui->btnViewPassword->setObjectName("btnViewPassword");
|
||||||
|
ui->btnChangePassword->setObjectName("btnChangePassword");
|
||||||
|
|
||||||
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
|
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
|
||||||
|
|
||||||
ui->editPassword->setEnabled(false);
|
ui->editPassword->setEnabled(false);
|
||||||
//#ifndef PROJECT_TYPE_DEBUG
|
#ifndef PROJECT_TYPE_DEBUG
|
||||||
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
ui->btnViewPassword->setEnabled(false);
|
ui->btnViewPassword->setEnabled(false);
|
||||||
|
ui->btnChangePassword->setEnabled(false);
|
||||||
|
|
||||||
ui->btnOK->setEnabled(false);
|
ui->btnOK->setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -50,8 +54,8 @@ void DialogEditTrainee::setTrainee(Trainee trainee)
|
|||||||
ui->editPassword->setEnabled(true);
|
ui->editPassword->setEnabled(true);
|
||||||
ui->btnViewPassword->setEnabled(true);
|
ui->btnViewPassword->setEnabled(true);
|
||||||
}
|
}
|
||||||
//else
|
else
|
||||||
//ui->editPassword->setText("*****");
|
ui->btnChangePassword->setEnabled(true);
|
||||||
|
|
||||||
ui->btnOK->setEnabled(false);
|
ui->btnOK->setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -62,7 +66,15 @@ Trainee DialogEditTrainee::getTrainee()
|
|||||||
|
|
||||||
trainee.setName(ui->editName->text());
|
trainee.setName(ui->editName->text());
|
||||||
trainee.setLogin(ui->editLogin->text());
|
trainee.setLogin(ui->editLogin->text());
|
||||||
trainee.setPassword(ui->editPassword->text());
|
|
||||||
|
if(flNeedHashPassword)
|
||||||
|
{
|
||||||
|
QString psw = ui->editPassword->text();
|
||||||
|
psw = HashTools::hashingMD5string(psw);
|
||||||
|
trainee.setPassword(psw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
trainee.setPassword(ui->editPassword->text());
|
||||||
|
|
||||||
trainee.setArchived(ui->checkArchived->isChecked());
|
trainee.setArchived(ui->checkArchived->isChecked());
|
||||||
trainee.setLoggedIn(ui->checkLoggedIn->isChecked());
|
trainee.setLoggedIn(ui->checkLoggedIn->isChecked());
|
||||||
@@ -109,3 +121,12 @@ void DialogEditTrainee::on_btnViewPassword_released()
|
|||||||
{
|
{
|
||||||
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogEditTrainee::on_btnChangePassword_clicked()
|
||||||
|
{
|
||||||
|
ui->editPassword->setEnabled(true);
|
||||||
|
ui->btnViewPassword->setEnabled(true);
|
||||||
|
|
||||||
|
ui->editPassword->setText("");
|
||||||
|
flNeedHashPassword = true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ private slots:
|
|||||||
|
|
||||||
void on_btnViewPassword_released();
|
void on_btnViewPassword_released();
|
||||||
|
|
||||||
|
void on_btnChangePassword_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void verify();
|
void verify();
|
||||||
|
|
||||||
@@ -39,6 +41,8 @@ private:
|
|||||||
Ui::DialogEditTrainee *ui;
|
Ui::DialogEditTrainee *ui;
|
||||||
|
|
||||||
Trainee traineeInput;
|
Trainee traineeInput;
|
||||||
|
|
||||||
|
bool flNeedHashPassword;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGEDITTRAINEE_H
|
#endif // DIALOGEDITTRAINEE_H
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>300</width>
|
<width>470</width>
|
||||||
<height>252</height>
|
<height>252</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -106,6 +106,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnChangePassword">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/resources/icons/exchange.png</normaloff>:/resources/icons/exchange.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user