fix registration in Math Blaster

This commit is contained in:
Robert Paciorek 2023-09-09 09:05:38 +00:00
parent 7189f049e8
commit b2220ccfdb
2 changed files with 15 additions and 2 deletions

View File

@ -39,7 +39,7 @@ public class AuthenticationController : Controller {
// Authenticate the user
User? user = null;
uint gameVersion = ClientVersion.GetVersion(apiKey);
if (gameVersion == ClientVersion.WoJS) {
if (gameVersion == ClientVersion.WoJS || gameVersion == ClientVersion.MB) {
user = ctx.Users.FirstOrDefault(e => e.Email == data.UserName);
} else {
user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);

View File

@ -53,7 +53,7 @@ public class RegistrationController : Controller {
[Route("v3/RegistrationWebService.asmx/RegisterParent")]
[DecryptRequest("parentRegistrationData")]
[EncryptResponse]
public IActionResult RegisterParent() {
public IActionResult RegisterParent([FromForm] string apiKey) {
ParentRegistrationData data = XmlUtil.DeserializeXml<ParentRegistrationData>(Request.Form["parentRegistrationData"]);
User u = new User {
Id = Guid.NewGuid(),
@ -74,6 +74,19 @@ public class RegistrationController : Controller {
}
ctx.Users.Add(u);
if(gameVersion == ClientVersion.MB) {
Viking v = new Viking {
Uid = Guid.NewGuid(),
Name = data.ChildList[0].ChildName,
User = u,
InventoryItems = new List<InventoryItem>(),
AchievementPoints = new List<AchievementPoints>(),
Rooms = new List<Room>()
};
ctx.Vikings.Add(v);
}
ctx.SaveChanges();
ParentLoginInfo pli = new ParentLoginInfo {