Add confirm password in AccountFormDialog.
This commit is contained in:
@@ -24,6 +24,7 @@ AccountFormDialog::AccountFormDialog(QWidget* parent, AccountEditMode mode, Qt::
|
|||||||
, mLeUserName(new ULineEdit(this))
|
, mLeUserName(new ULineEdit(this))
|
||||||
, mLeComment(new ULineEdit(this))
|
, mLeComment(new ULineEdit(this))
|
||||||
, mLePwd(nullptr)
|
, mLePwd(nullptr)
|
||||||
|
, mConfirmPwd(nullptr)
|
||||||
, mBtnPwd(nullptr)
|
, mBtnPwd(nullptr)
|
||||||
, mLblError(new QLabel(this))
|
, mLblError(new QLabel(this))
|
||||||
, mRefModel(nullptr)
|
, mRefModel(nullptr)
|
||||||
@@ -181,6 +182,15 @@ void AccountFormDialog::addNewModeUI(QVBoxLayout* layout)
|
|||||||
layout->addWidget(mLePwd);
|
layout->addWidget(mLePwd);
|
||||||
mRoleID = User::getRoleID("doctor");
|
mRoleID = User::getRoleID("doctor");
|
||||||
addEndLine(layout);
|
addEndLine(layout);
|
||||||
|
|
||||||
|
lblPwd = new QLabel(this);
|
||||||
|
lblPwd->setText(tr("Confirm Password"));
|
||||||
|
layout->addWidget(lblPwd);
|
||||||
|
mConfirmPwd = new ULineEdit(this);
|
||||||
|
mConfirmPwd->setPlaceholderText(tr("Input password"));
|
||||||
|
mConfirmPwd->setEchoMode(QLineEdit::Password);
|
||||||
|
layout->addWidget(mConfirmPwd);
|
||||||
|
addEndLine(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountFormDialog::updateReferenceData()
|
bool AccountFormDialog::updateReferenceData()
|
||||||
@@ -253,6 +263,11 @@ bool AccountFormDialog::updateReferenceData()
|
|||||||
warn(tr("Password can't be empty!"));
|
warn(tr("Password can't be empty!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (mLePwd->text() != mConfirmPwd->text())
|
||||||
|
{
|
||||||
|
warn(tr("Password and confirm password do not match!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!mRefModel)
|
if (!mRefModel)
|
||||||
{
|
{
|
||||||
warn(tr("Inner error ,unset data model!"));
|
warn(tr("Inner error ,unset data model!"));
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private:
|
|||||||
ULineEdit* mLeUserName;
|
ULineEdit* mLeUserName;
|
||||||
ULineEdit* mLeComment;
|
ULineEdit* mLeComment;
|
||||||
ULineEdit* mLePwd;
|
ULineEdit* mLePwd;
|
||||||
|
ULineEdit* mConfirmPwd;
|
||||||
QToolButton* mBtnPwd;
|
QToolButton* mBtnPwd;
|
||||||
|
|
||||||
QLabel* mLblError;
|
QLabel* mLblError;
|
||||||
|
|||||||
Reference in New Issue
Block a user