don't allow loging in using email as username

(actually, just don't allow @ in usernames)
This commit is contained in:
jacob1
2017-06-09 23:54:43 -04:00
parent 25b3244d6c
commit 3d9d57e0ff
2 changed files with 8 additions and 4 deletions

View File

@@ -8,6 +8,13 @@ LoginModel::LoginModel():
void LoginModel::Login(string username, string password) void LoginModel::Login(string username, string password)
{ {
if (username.find('@') != username.npos)
{
statusText = "Use your Powder Toy account to log in, not your email. If you don't have a Powder Toy account, you can create one at https://powdertoy.co.uk/Register.html";
loginStatus = false;
notifyStatusChanged();
return;
}
statusText = "Logging in..."; statusText = "Logging in...";
loginStatus = false; loginStatus = false;
notifyStatusChanged(); notifyStatusChanged();
@@ -20,9 +27,6 @@ void LoginModel::Login(string username, string password)
break; break;
case LoginError: case LoginError:
statusText = Client::Ref().GetLastError(); statusText = Client::Ref().GetLastError();
size_t banStart = statusText.find(". Ban expire in"); //TODO: temporary, remove this when the ban message is fixed
if (banStart != statusText.npos)
statusText.replace(banStart, 15, ". Login at http://powdertoy.co.uk in order to see the full ban reason. Ban expires in");
break; break;
} }
notifyStatusChanged(); notifyStatusChanged();

View File

@@ -93,7 +93,7 @@ void LoginView::OnTryExit(ExitMethod method)
void LoginView::NotifyStatusChanged(LoginModel * sender) void LoginView::NotifyStatusChanged(LoginModel * sender)
{ {
if (infoLabel->Visible) if (infoLabel->Visible)
targetSize.Y -= infoLabel->Size.Y+2; targetSize.Y = 87;
infoLabel->SetText(sender->GetStatusText()); infoLabel->SetText(sender->GetStatusText());
infoLabel->AutoHeight(); infoLabel->AutoHeight();
if (sender->GetStatusText().length()) if (sender->GetStatusText().length())