Register command no longer has a username param.

Password checking fixed.
This commit is contained in:
Zidonuke 2011-12-29 00:14:57 -05:00
parent 8523df9308
commit 1671db928b
2 changed files with 12 additions and 18 deletions

View file

@ -427,16 +427,17 @@ namespace TShockAPI
{
try
{
if (args.Parameters.Count == 2)
if (args.Parameters.Count == 1)
{
var user = new User();
user.Name = args.Parameters[0];
user.Password = args.Parameters[1];
user.Name = args.Player.Name;
user.Password = args.Parameters[0];
user.Group = TShock.Config.DefaultRegistrationGroupName; // FIXME -- we should get this from the DB.
if (TShock.Users.GetUserByName(user.Name) == null) // Cheap way of checking for existance of a user
{
args.Player.SendMessage("Account " + user.Name + " has been registered.", Color.Green);
args.Player.SendMessage("Your password is " + user.Password);
TShock.Users.AddUser(user);
Log.ConsoleInfo(args.Player.Name + " registered an Account: " + user.Name);
}
@ -449,7 +450,7 @@ namespace TShockAPI
}
else
{
args.Player.SendMessage("Invalid syntax! Proper syntax: /register <username> <password>", Color.Red);
args.Player.SendMessage("Invalid syntax! Proper syntax: /register <password>", Color.Red);
}
}
catch (UserManagerException ex)

View file

@ -303,18 +303,14 @@ namespace TShockAPI
args.Player.PlayerData.CopyInventory(args.Player);
TShock.InventoryDB.InsertPlayerData(args.Player);
args.Player.SendMessage("Authenticated as " + args.Player + " successfully.", Color.LimeGreen);
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user: " + args.Player);
return true;
}
else
{
TShock.Utils.ForceKick(args.Player, "Incorrect Account Password, use the password you created with /register");
args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen);
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user: " + args.Player.Name);
return true;
}
TShock.Utils.ForceKick(args.Player, "Incorrect User Account Password");
return true;
}
else if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
{
if(TShock.Config.ServerPassword == password)
{
@ -324,11 +320,8 @@ namespace TShockAPI
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
return true;
}
else
{
TShock.Utils.ForceKick(args.Player, "Incorrect Server Password");
return true;
}
TShock.Utils.ForceKick(args.Player, "Incorrect Server Password");
return true;
}
TShock.Utils.ForceKick(args.Player, "Bad Password Attempt");