mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 12:32:40 +02:00
don't allow loging in using email as username
(actually, just don't allow @ in usernames)
This commit is contained in:
@@ -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();
|
||||||
|
@@ -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())
|
||||||
|
Reference in New Issue
Block a user