diff --git a/src/dialogs/AccountFormDialog.cpp b/src/dialogs/AccountFormDialog.cpp index cc86e53..1555c9f 100644 --- a/src/dialogs/AccountFormDialog.cpp +++ b/src/dialogs/AccountFormDialog.cpp @@ -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!")); diff --git a/src/windows/LoginDialog.cpp b/src/windows/LoginDialog.cpp index a146307..01dbd5e 100644 --- a/src/windows/LoginDialog.cpp +++ b/src/windows/LoginDialog.cpp @@ -129,6 +129,7 @@ void LoginDialog::initializeEdit() mAccountEdit->setObjectName("combobox_UserName"); mAccountEdit->setPlaceholderText(tr("Username")); mAccountEdit->setFocusPolicy(Qt::ClickFocus); + mAccountEdit->setMaxLength(30); accountEditAreaLayout->addWidget(mAccountEdit); accountEditAreaLayout->addItem(new QSpacerItem(49,20,QSizePolicy::Fixed)); mDialogContentsLayout->addWidget(accountEditArea); @@ -140,6 +141,7 @@ void LoginDialog::initializeEdit() mPasswordEdit->setEchoMode(QLineEdit::Password); mPasswordEdit->setPlaceholderText(tr("Password")); mPasswordEdit->setFocusPolicy(Qt::ClickFocus); + mPasswordEdit->setMaxLength(30); passwordEditAreaLayout->addWidget(mPasswordEdit); passwordEditAreaLayout->addWidget(mShowPasswordButton); mShowPasswordButton->setObjectName("ShowPasswordButton"); @@ -186,7 +188,7 @@ void LoginDialog::doLogin() { if (!(AppGlobalValues::DBconnected().toBool())) { - mErrorMessage->setText(QString(tr("Can't connect db. Please reboot the device and retry, or call for the service help.")).arg(LOGIN_LOCK_MINUTIES)); + mErrorMessage->setText(tr("Can't connect db. Please reboot the device and retry, or call for the service help.")); mErrorMessage->setVisible(true); return; }