// guid, newGUID, newPassword // <Error>Error.invalidEmail</Error> // <Error>LinkWebAccountDialog.matchErrorSame</Error> protected override void HandleRequest() { if (!IsValidEmail(Query["newGUID"]) || Query["newPassword"] == null || Query["guid"] == null) { WriteErrorLine("Invalid email"); } else { string key = Database.REG_LOCK; string lockToken = null; try { while ((lockToken = Database.AcquireLock(key)) == null) { ; } DbAccount acc; LoginStatus status = Database.Verify(Query["guid"], "", out acc); if (status == LoginStatus.OK) { //what? can register in game? kill the account lock Database.RenameUUID(acc, Query["newGUID"], lockToken); Database.ChangePassword(acc.UUID, Query["newPassword"]); WriteLine("<Success />"); } else { RegisterStatus s = Database.Register(Query["newGUID"], Query["newPassword"], false, out acc); if (s == RegisterStatus.OK) { WriteLine("<Success />"); } else { WriteErrorLine(s.GetInfo()); } } } finally { if (lockToken != null) { Database.ReleaseLock(key, lockToken); } } } }