diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-13 18:05:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-13 18:05:46 +0300 |
commit | e0ffa76b8c20450a32c94ae9c96b58c5f7c0ccfa (patch) | |
tree | e427771bf07d778cd02d5904a7843612e2abfedc | |
parent | ed2cd3915f6801d20feaee206caad89896524590 (diff) | |
download | plus-e0ffa76b8c20450a32c94ae9c96b58c5f7c0ccfa.tar.gz plus-e0ffa76b8c20450a32c94ae9c96b58c5f7c0ccfa.tar.bz2 plus-e0ffa76b8c20450a32c94ae9c96b58c5f7c0ccfa.tar.xz plus-e0ffa76b8c20450a32c94ae9c96b58c5f7c0ccfa.zip |
Not allow registration with empty or broken email.
-rw-r--r-- | src/gui/windows/registerdialog.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 7a52a6129..2377d1928 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -119,6 +119,9 @@ RegisterDialog::RegisterDialog(LoginData &data) : mEmailField = new TextField(this); placer(0, row, emailLabel); placer(1, row, mEmailField, 3).setPadding(2); + mEmailField->addKeyListener(this); + mEmailField->setActionEventId("register"); + mEmailField->addActionListener(this); // row++; } @@ -221,6 +224,23 @@ void RegisterDialog::action(const ActionEvent &event) errorMsg = _("Passwords do not match."); error = 2; } + else if (mEmailField && + mEmailField->getText().find("@") == std::string::npos) + { + errorMsg = strprintf + // TRANSLATORS: error message + (_("Incorrect email."), + minUser); + error = 1; + } + else if (mEmailField && mEmailField->getText().size() > 40) + { + errorMsg = strprintf + // TRANSLATORS: error message + (_("Email too long."), + minUser); + error = 1; + } if (error > 0) { @@ -296,7 +316,8 @@ bool RegisterDialog::canSubmit() const return !mUserField->getText().empty() && !mPasswordField->getText().empty() && !mConfirmField->getText().empty() && - client->getState() == STATE_REGISTER; + client->getState() == STATE_REGISTER && + (!mEmailField || !mEmailField->getText().empty()); } void RegisterDialog::close() |