fix: update memory auth data.
parent
8645caf4a3
commit
31c16cc7e2
|
@ -49,7 +49,7 @@ namespace Storage.Test {
|
||||||
Assert.NotNull(current.ObjectId);
|
Assert.NotNull(current.ObjectId);
|
||||||
Assert.IsFalse(current.EmailVerified);
|
Assert.IsFalse(current.EmailVerified);
|
||||||
Assert.IsFalse(current.MobileVerified);
|
Assert.IsFalse(current.MobileVerified);
|
||||||
Assert.AreEqual(current.Mobile, "15101006008");
|
Assert.AreEqual(current.Mobile, "15101006007");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -70,7 +70,7 @@ namespace Storage.Test {
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task RelateObject() {
|
public async Task RelateObject() {
|
||||||
LCUser user = await LCUser.LoginByMobilePhoneNumber("15101006007", "112358");
|
LCUser user = await LCUser.LoginByMobilePhoneNumber("15101006007", "world");
|
||||||
LCObject account = new LCObject("Account");
|
LCObject account = new LCObject("Account");
|
||||||
account["user"] = user;
|
account["user"] = user;
|
||||||
await account.Save();
|
await account.Save();
|
||||||
|
|
|
@ -531,8 +531,8 @@ namespace LeanCloud.Storage {
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await Save();
|
await Save();
|
||||||
oriAuthData.Add(authType, data);
|
oriAuthData[authType] = data;
|
||||||
AuthData = oriAuthData;
|
UpdateAuthData(oriAuthData);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
AuthData = oriAuthData;
|
AuthData = oriAuthData;
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -547,13 +547,19 @@ namespace LeanCloud.Storage {
|
||||||
try {
|
try {
|
||||||
await Save();
|
await Save();
|
||||||
oriAuthData.Remove(authType);
|
oriAuthData.Remove(authType);
|
||||||
AuthData = oriAuthData;
|
UpdateAuthData(oriAuthData);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
AuthData = oriAuthData;
|
AuthData = oriAuthData;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateAuthData(Dictionary<string, object> authData) {
|
||||||
|
LCObjectData objData = new LCObjectData();
|
||||||
|
objData.CustomPropertyDict["authData"] = authData;
|
||||||
|
Merge(objData);
|
||||||
|
}
|
||||||
|
|
||||||
static async Task<LCUser> Login(Dictionary<string, object> data) {
|
static async Task<LCUser> Login(Dictionary<string, object> data) {
|
||||||
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>("login", data: data);
|
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>("login", data: data);
|
||||||
LCObjectData objectData = LCObjectData.Decode(response);
|
LCObjectData objectData = LCObjectData.Decode(response);
|
||||||
|
|
Loading…
Reference in New Issue