Skip to content

Commit

Permalink
don't allow loging in using email as username
Browse files Browse the repository at this point in the history
(actually, just don't allow @ in usernames)
  • Loading branch information
jacob1 committed Jun 10, 2017
1 parent 25b3244 commit 3d9d57e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/gui/login/LoginModel.cpp
Expand Up @@ -8,6 +8,13 @@ LoginModel::LoginModel():

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...";
loginStatus = false;
notifyStatusChanged();
Expand All @@ -20,9 +27,6 @@ void LoginModel::Login(string username, string password)
break;
case LoginError:
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;
}
notifyStatusChanged();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/login/LoginView.cpp
Expand Up @@ -93,7 +93,7 @@ void LoginView::OnTryExit(ExitMethod method)
void LoginView::NotifyStatusChanged(LoginModel * sender)
{
if (infoLabel->Visible)
targetSize.Y -= infoLabel->Size.Y+2;
targetSize.Y = 87;
infoLabel->SetText(sender->GetStatusText());
infoLabel->AutoHeight();
if (sender->GetStatusText().length())
Expand Down

0 comments on commit 3d9d57e

Please sign in to comment.