Only let users modify their own characters
This commit is contained in:
@ -35,18 +35,25 @@ namespace NightmareCoreWeb2.Pages
|
|||||||
}
|
}
|
||||||
public void OnGetCharacterAction(int guid, int action)
|
public void OnGetCharacterAction(int guid, int action)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
OnGet();
|
||||||
if (!IsAuthenticated)
|
if (!IsAuthenticated)
|
||||||
{
|
{
|
||||||
OnGet();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Character c = new Character(guid);
|
Character c = new Character(guid);
|
||||||
|
foreach (Character test in this.UserAccount.Characters)
|
||||||
|
{
|
||||||
|
if (test.guid == c.guid)
|
||||||
|
{
|
||||||
|
|
||||||
if ((c.AtLogin & Character.AtLoginOptions.AT_LOGIN_FIRST) == 0)
|
if ((c.AtLogin & Character.AtLoginOptions.AT_LOGIN_FIRST) == 0)
|
||||||
{
|
{
|
||||||
c.AtLogin |= (Character.AtLoginOptions)action;
|
c.AtLogin |= (Character.AtLoginOptions)action;
|
||||||
}
|
}
|
||||||
c.SetAtLogin();
|
c.SetAtLogin();
|
||||||
OnGet();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void OnGet()
|
public void OnGet()
|
||||||
@ -65,7 +72,9 @@ namespace NightmareCoreWeb2.Pages
|
|||||||
Console.WriteLine($"Failed to authenticate {this.UserAccount.Username}");
|
Console.WriteLine($"Failed to authenticate {this.UserAccount.Username}");
|
||||||
Response.Cookies.Delete("Username");
|
Response.Cookies.Delete("Username");
|
||||||
Response.Cookies.Delete("AuthToken");
|
Response.Cookies.Delete("AuthToken");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.IsAuthenticated = true;
|
this.IsAuthenticated = true;
|
||||||
}
|
}
|
||||||
SetupAccount(this.UserAccount.Username);
|
SetupAccount(this.UserAccount.Username);
|
||||||
|
|||||||
Reference in New Issue
Block a user