Improved login error messages and onboarding process

Added config based checks so error messages only tell what is relevant to the user. Doesn't make any sense to tell them you can do /login when UUID is set to false because they will just get the same error message again. Also added an additional info message to the onboarding/password registration process so the next steps will be more obvious for first time users.
This commit is contained in:
stacey 2021-07-19 20:03:39 -04:00 committed by GitHub
parent 35d9a8e715
commit 1521c8b28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -807,9 +807,17 @@ namespace TShockAPI
}
else
{
args.Player.SendErrorMessage("Syntax: {0}login - Logs in using your UUID and character name", Specifier);
args.Player.SendErrorMessage(" {0}login <password> - Logs in using your password and character name", Specifier);
args.Player.SendErrorMessage(" {0}login <username> <password> - Logs in using your username and password", Specifier);
if (TShock.Config.Settings.DisableUUIDLogin && !TShock.Config.Settings.AllowLoginAnyUsername)
args.Player.SendErrorMessage($"Syntax: {Specifier}login <password> - Logs in using your password and character name");
else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername)
{
args.Player.SendErrorMessage($"Syntax: {Specifier}login <password> - Logs in using your password and character name");
args.Player.SendErrorMessage($" {Specifier}login <username> <password> - Logs in using your username and password");
}
else
{
args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your UUID and character name");
}
args.Player.SendErrorMessage("If you forgot your password, there is no way to recover it.");
return;
}
@ -991,6 +999,14 @@ namespace TShockAPI
{
args.Player.SendSuccessMessage("Account \"{0}\" has been registered.", account.Name);
args.Player.SendSuccessMessage("Your password is {0}.", echoPassword);
if (TShock.Config.Settings.DisableUUIDLogin && !TShock.Config.Settings.AllowLoginAnyUsername)
args.Player.SendInfoMessage($"Type {Specifier}login <password> to sign in to your account.");
else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername)
args.Player.SendInfoMessage($"Type {Specifier}login <username> <password> to sign in to your account.");
else
{
args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account.");
}
TShock.UserAccounts.AddUserAccount(account);
TShock.Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, account.Name);
}