feat: Make user id and user password input max length to 30.

This commit is contained in:
sunwen
2024-06-20 17:21:01 +08:00
parent 23f8aea990
commit fd8632e888
2 changed files with 12 additions and 1 deletions

View File

@@ -57,6 +57,8 @@ AccountFormDialog::AccountFormDialog(QWidget* parent, AccountEditMode mode, Qt::
mNewUserName = text;
mUserNameChanged = true;
});
mLeUserCode->setMaxLength(30);
}
void AccountFormDialog::addEndLine(QVBoxLayout* layout)
@@ -182,6 +184,7 @@ void AccountFormDialog::addNewModeUI(QVBoxLayout* layout)
mLePwd = new ULineEdit(this);
mLePwd->setPlaceholderText(tr("Input password"));
mLePwd->setEchoMode(QLineEdit::Password);
mLePwd->setMaxLength(30);
layout->addWidget(mLePwd);
mRoleID = User::getRoleID("doctor");
addEndLine(layout);
@@ -192,6 +195,7 @@ void AccountFormDialog::addNewModeUI(QVBoxLayout* layout)
mConfirmPwd = new ULineEdit(this);
mConfirmPwd->setPlaceholderText(tr("Input password"));
mConfirmPwd->setEchoMode(QLineEdit::Password);
mConfirmPwd->setMaxLength(30);
layout->addWidget(mConfirmPwd);
addEndLine(layout);
}
@@ -266,6 +270,11 @@ bool AccountFormDialog::updateReferenceData()
warn(tr("Password can't be empty!"));
return false;
}
if (mLePwd->text().length() < 6)
{
warn(tr("Password should at least 6 characters!"));
return false;
}
if (mLePwd->text() != mConfirmPwd->text())
{
warn(tr("Password and confirm password do not match!"));