From 1a11da01bc18089d7dd569258e15895dfc1fd72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B2=BD=EB=A1=9C?= <80889873+dlrudfh@users.noreply.github.com> Date: Sun, 14 Nov 2021 16:20:15 +0900 Subject: [PATCH] Revised email issue and some kr translation (#4673) --- src/states_screens/online/register_screen.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/states_screens/online/register_screen.cpp b/src/states_screens/online/register_screen.cpp index 59408cb44..5c398f976 100644 --- a/src/states_screens/online/register_screen.cpp +++ b/src/states_screens/online/register_screen.cpp @@ -341,6 +341,18 @@ void RegisterScreen::doRegister() email_confirm.trim(); m_info_widget->setErrorColor(); + bool namecheck = false; + for (int i = 0; i < username.size();i++) + { + if (!((username[i] >= '0' && username[i] <= '9') || + (username[i] >= 'a' && username[i] <= 'z') || + (username[i] >= 'A' && username[i] <= 'Z') || + username[i] == '.' || username[i] == '-' || username[i] == '_')) + { + namecheck = true; + break; + } + } if (password != password_confirm) { m_info_widget->setText(_("Passwords don't match!"), false); @@ -349,6 +361,10 @@ void RegisterScreen::doRegister() { m_info_widget->setText(_("Emails don't match!"), false); } + else if (namecheck) + { + m_info_widget->setText(_("Your username can only contain alphanumeric characters, periods, dashes and underscores!"), false); + } else if (username.size() < 3 || username.size() > 30) { m_info_widget->setText(_("Online username has to be between 3 and 30 characters long!"), false); @@ -367,10 +383,11 @@ void RegisterScreen::doRegister() } else if ( email.find(L"@")== -1 || email.find(L".")== -1 || (email.findLast(L'.') - email.findLast(L'@') <= 2 ) || - email.findLast(L'@')==0 ) + email.findLast(L'@')==0 || email[(email.size())-1]=='.') { - m_info_widget->setText(_("Email is invalid!"), false); + m_info_widget->setText(_("Email is invalid!"), false); } + else { m_info_widget->setDefaultColor();