missed UserAccount declarations
This commit is contained in:
parent
6589531868
commit
5c24ba6f8d
1 changed files with 13 additions and 13 deletions
|
|
@ -520,11 +520,11 @@ namespace TShockAPI
|
||||||
return RestMissingParam("password");
|
return RestMissingParam("password");
|
||||||
|
|
||||||
// NOTE: ip can be blank
|
// NOTE: ip can be blank
|
||||||
UserAccount user = new UserAccount(username, "", "", group, "", "", "");
|
UserAccount account = new UserAccount(username, "", "", group, "", "", "");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.CreateBCryptHash(password);
|
account.CreateBCryptHash(password);
|
||||||
TShock.UserAccounts.AddUserAccount(user);
|
TShock.UserAccounts.AddUserAccount(account);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -553,13 +553,13 @@ namespace TShockAPI
|
||||||
if (string.IsNullOrWhiteSpace(group) && string.IsNullOrWhiteSpace(password))
|
if (string.IsNullOrWhiteSpace(group) && string.IsNullOrWhiteSpace(password))
|
||||||
return RestMissingParam("group", "password");
|
return RestMissingParam("group", "password");
|
||||||
|
|
||||||
UserAccount user = (UserAccount)ret;
|
UserAccount account = (UserAccount)ret;
|
||||||
var response = new RestObject();
|
var response = new RestObject();
|
||||||
if (!string.IsNullOrWhiteSpace(password))
|
if (!string.IsNullOrWhiteSpace(password))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TShock.UserAccounts.SetUserAccountPassword(user, password);
|
TShock.UserAccounts.SetUserAccountPassword(account, password);
|
||||||
response.Add("password-response", "Password updated successfully");
|
response.Add("password-response", "Password updated successfully");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
@ -572,7 +572,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TShock.UserAccounts.SetUserGroup(user, group);
|
TShock.UserAccounts.SetUserGroup(account, group);
|
||||||
response.Add("group-response", "Group updated successfully");
|
response.Add("group-response", "Group updated successfully");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
@ -620,8 +620,8 @@ namespace TShockAPI
|
||||||
if (ret is RestObject)
|
if (ret is RestObject)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
UserAccount user = (UserAccount)ret;
|
UserAccount account = (UserAccount)ret;
|
||||||
return new RestObject() { { "group", user.Group }, { "id", user.ID.ToString() }, { "name", user.Name } };
|
return new RestObject() { { "group", account.Group }, { "id", account.ID.ToString() }, { "name", account.Name } };
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -1283,7 +1283,7 @@ namespace TShockAPI
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
return RestMissingParam("user");
|
return RestMissingParam("user");
|
||||||
|
|
||||||
UserAccount user;
|
UserAccount account;
|
||||||
string type = parameters["type"];
|
string type = parameters["type"];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1292,10 +1292,10 @@ namespace TShockAPI
|
||||||
case null:
|
case null:
|
||||||
case "name":
|
case "name":
|
||||||
type = "name";
|
type = "name";
|
||||||
user = TShock.UserAccounts.GetUserAccountByName(name);
|
account = TShock.UserAccounts.GetUserAccountByName(name);
|
||||||
break;
|
break;
|
||||||
case "id":
|
case "id":
|
||||||
user = TShock.UserAccounts.GetUserAccountByID(Convert.ToInt32(name));
|
account = TShock.UserAccounts.GetUserAccountByID(Convert.ToInt32(name));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return RestError("Invalid Type: '" + type + "'");
|
return RestError("Invalid Type: '" + type + "'");
|
||||||
|
|
@ -1306,10 +1306,10 @@ namespace TShockAPI
|
||||||
return RestError(e.Message);
|
return RestError(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == user)
|
if (null == account)
|
||||||
return RestError(String.Format("User {0} '{1}' doesn't exist", type, name));
|
return RestError(String.Format("User {0} '{1}' doesn't exist", type, name));
|
||||||
|
|
||||||
return user;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
private object BanFind(IParameterCollection parameters)
|
private object BanFind(IParameterCollection parameters)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue