Removed error constructor. Added response property.

This commit is contained in:
high 2011-09-05 14:05:16 -04:00
parent 89f5d13efb
commit a0da52e558
3 changed files with 10 additions and 10 deletions

View file

@ -222,20 +222,20 @@ namespace TShockAPI
var userAccount = TShock.Users.GetUserByName(username);
if (userAccount == null)
{
return new RestObject("401", "Invalid username/password combination provided. Please re-submit your query with a correct pair.");
return new RestObject("401") { Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair." };
}
if (Tools.HashPassword(password).ToUpper() != userAccount.Password.ToUpper())
{
return new RestObject("401", "Invalid username/password combination provided. Please re-submit your query with a correct pair.");
return new RestObject("401") { Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair." };
}
if (!Tools.GetGroup(userAccount.Group).HasPermission("api") && userAccount.Group != "superadmin")
{
return new RestObject("403", "Although your account was successfully found and identified, your account lacks the permission required to use the API. (api)");
return new RestObject("403") { Error = "Although your account was successfully found and identified, your account lacks the permission required to use the API. (api)" };
}
return new RestObject("200"); //Maybe return some user info too?
return new RestObject("200") { Response = "Successful login" }; //Maybe return some user info too?
}
public override void DeInitialize()