com.xd.sdk.account 6.29.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs.meta +1 -1
- package/Plugins/Android.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
- package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
- package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
- package/Plugins/iOS.meta +1 -1
- package/Plugins.meta +1 -1
- package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
- package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
- package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http.meta +3 -0
- package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
- package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
- package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
- package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth.meta +8 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Compliance.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Track.meta +8 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
- package/Runtime/Internal/Standalone/UI.meta +8 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UserModule.cs +604 -0
- package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
- package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
- package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
- package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
- package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
- package/Runtime/Internal/XDGAccountInternal.cs +86 -0
- package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
- package/Runtime/Internal.meta +1 -1
- package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
- package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
- package/Runtime/Public/XDGAccount.cs +107 -0
- package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Account.asmdef +7 -2
- package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
- package/Runtime.meta +1 -1
- package/package.json +5 -5
- package/package.json.meta +2 -2
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
- package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
- package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
- package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
- package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
- package/Mobile/Plugins/Android/com/xd.meta +0 -8
- package/Mobile/Plugins/Android/com.meta +0 -8
- package/Mobile/Plugins/Android.meta +0 -8
- package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
- package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
- package/Mobile/Plugins/iOS.meta +0 -8
- package/Mobile/User/UserManagerMobile.cs +0 -45
- package/Mobile/User.meta +0 -8
- package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
- package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
- package/Mobile/XDGAccountMobile.cs +0 -138
- package/Mobile/XDGAccountMobileImpl.cs +0 -444
- package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
- package/Mobile/XDGTokenManager.cs +0 -116
- package/Mobile/XDGTokenManager.cs.meta +0 -11
- package/Mobile/XDGUserWrapper.cs +0 -167
- package/Mobile/XDGUserWrapper.cs.meta +0 -11
- package/Plugins/Android/libs/XDGAccount_6.29.1.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.1.aar.meta +0 -32
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
- package/README.md +0 -0
- package/README.md.meta +0 -7
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
- package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
- package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
- package/Runtime/Editor.meta +0 -8
- package/Runtime/IXDGAccount.cs +0 -44
- package/Runtime/IXDGAccount.cs.meta +0 -11
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http.meta +0 -8
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
- package/Runtime/Internal/User.meta +0 -8
- package/Runtime/UserManager.cs +0 -35
- package/Runtime/UserManager.cs.meta +0 -11
- package/Runtime/XDGAccessToken.cs +0 -18
- package/Runtime/XDGAccessToken.cs.meta +0 -11
- package/Runtime/XDGAccount.cs +0 -130
- package/Runtime/XDGLoginType.cs +0 -17
- package/Runtime/XDGLoginType.cs.meta +0 -11
- package/Runtime/XDGRoleInfo.cs +0 -24
- package/Runtime/XDGRoleInfo.cs.meta +0 -11
- package/Runtime/XDGUser.cs +0 -30
- package/Runtime/XDGUser.cs.meta +0 -11
- package/Runtime/XDGUserStatusCode.cs +0 -16
- package/Runtime/XDGUserStatusCode.cs.meta +0 -11
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal;
|
|
7
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
11
|
+
{
|
|
12
|
+
public static class EmailModule
|
|
13
|
+
{
|
|
14
|
+
private static readonly string XDG_LOGIN_CODE_SEND = "api/login/v1/verification/code/send";
|
|
15
|
+
private static readonly string XDG_UNBIND_CODE_SEND = "api/account/v1/unbind/verification/code/send";
|
|
16
|
+
|
|
17
|
+
public const int RISK_CONTROL = 40024;
|
|
18
|
+
public const int RISK_CONTROL_FAILED = 40025;
|
|
19
|
+
public const int INVALID_EMAIL_FORMAT = 40031;
|
|
20
|
+
public const int INVALID_VERIFY_CODE = 40114;
|
|
21
|
+
|
|
22
|
+
private static EmailAlert loginAlert;
|
|
23
|
+
private static CodeUnbindAlert unbindAlert;
|
|
24
|
+
|
|
25
|
+
public static Task LoginOrBind(bool login)
|
|
26
|
+
{
|
|
27
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
28
|
+
AliyunTrack.LoginAuthorize();
|
|
29
|
+
if (login)
|
|
30
|
+
{
|
|
31
|
+
AliyunTrack.LoginTrackEmailData();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
loginAlert = UIManager.ShowUI<EmailAlert>("XDEmailAlert", new Dictionary<string, object>() { { "login", login } }, async (code, data) =>
|
|
35
|
+
{
|
|
36
|
+
switch (code)
|
|
37
|
+
{
|
|
38
|
+
case EmailAlert.CLOSE_CODE:
|
|
39
|
+
UIManager.Dismiss();
|
|
40
|
+
AliyunTrack.LoginAuthorizeFail("cancel");
|
|
41
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
42
|
+
break;
|
|
43
|
+
case EmailAlert.SEND_CODE:
|
|
44
|
+
try
|
|
45
|
+
{
|
|
46
|
+
EmailAlert.Data emailData = data as EmailAlert.Data;
|
|
47
|
+
if (emailData?.email.Length != 0)
|
|
48
|
+
{
|
|
49
|
+
await RequestLoginVerifyCode(emailData?.email);
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
{
|
|
53
|
+
loginAlert.UpdateEmailError(XDLocalization.GetCurrentLocalizableString().EmailEmpty);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (Exception)
|
|
57
|
+
{
|
|
58
|
+
UIManager.DismissLoading();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
break;
|
|
62
|
+
case EmailAlert.LOGIN_OR_BIND:
|
|
63
|
+
try
|
|
64
|
+
{
|
|
65
|
+
EmailAlert.Data emailData = data as EmailAlert.Data;
|
|
66
|
+
if (emailData?.email.Length != 0)
|
|
67
|
+
{
|
|
68
|
+
if (emailData?.code.Length != 0)
|
|
69
|
+
{
|
|
70
|
+
if (login)
|
|
71
|
+
{
|
|
72
|
+
await LoginByEmail(emailData?.email, emailData?.code);
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
await BindByEmail(emailData?.email, emailData?.code);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
UIManager.Dismiss();
|
|
80
|
+
tcs.TrySetResult(null);
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
{
|
|
84
|
+
loginAlert.UpdateCodeError(XDLocalization.GetCurrentLocalizableString().CodeEmpty);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else
|
|
88
|
+
{
|
|
89
|
+
loginAlert.UpdateEmailError(XDLocalization.GetCurrentLocalizableString().EmailEmpty);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (XDGError e)
|
|
93
|
+
{
|
|
94
|
+
if (e.Code == INVALID_VERIFY_CODE)
|
|
95
|
+
{
|
|
96
|
+
loginAlert.UpdateCodeError(e.ErrorMsg);
|
|
97
|
+
}
|
|
98
|
+
else if (e.Code == INVALID_EMAIL_FORMAT)
|
|
99
|
+
{
|
|
100
|
+
loginAlert.UpdateEmailError(e.ErrorMsg);
|
|
101
|
+
}
|
|
102
|
+
else
|
|
103
|
+
{
|
|
104
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (Exception e)
|
|
108
|
+
{
|
|
109
|
+
tcs.TrySetException(e);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return tcs.Task;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public static Task Unbind(Dictionary<string, object> extras)
|
|
119
|
+
{
|
|
120
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
121
|
+
unbindAlert = UIManager.ShowUI<CodeUnbindAlert>("XDCodeUnbindAlert", extras, async (code, data) =>
|
|
122
|
+
{
|
|
123
|
+
switch (code)
|
|
124
|
+
{
|
|
125
|
+
case CodeUnbindAlert.CLOSE_CODE:
|
|
126
|
+
UIManager.Dismiss();
|
|
127
|
+
AliyunTrack.LoginAuthorizeFail("cancel");
|
|
128
|
+
AliyunTrack.LoginFail("cancel");
|
|
129
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
130
|
+
break;
|
|
131
|
+
case CodeUnbindAlert.SEND_CODE:
|
|
132
|
+
{
|
|
133
|
+
try
|
|
134
|
+
{
|
|
135
|
+
await RequestUnbindVerifyCode();
|
|
136
|
+
}
|
|
137
|
+
catch (Exception)
|
|
138
|
+
{
|
|
139
|
+
UIManager.DismissLoading();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case CodeUnbindAlert.UNBIND:
|
|
144
|
+
{
|
|
145
|
+
try
|
|
146
|
+
{
|
|
147
|
+
CodeUnbindAlert.Data unbindData = data as CodeUnbindAlert.Data;
|
|
148
|
+
await UnbindByEmail(unbindData?.code);
|
|
149
|
+
UIManager.Dismiss();
|
|
150
|
+
tcs.TrySetResult(null);
|
|
151
|
+
}
|
|
152
|
+
catch (XDGError e)
|
|
153
|
+
{
|
|
154
|
+
if (e.Code == INVALID_VERIFY_CODE)
|
|
155
|
+
{
|
|
156
|
+
unbindAlert.UpdateCodeError(e.ErrorMsg);
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
{
|
|
160
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (Exception e)
|
|
164
|
+
{
|
|
165
|
+
tcs.TrySetException(e);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return tcs.Task;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private static async Task<RequestVerifyCodeData> RequestLoginVerifyCode(string email, string riskControlData = null)
|
|
175
|
+
{
|
|
176
|
+
Dictionary<string, object> data = new Dictionary<string, object>
|
|
177
|
+
{
|
|
178
|
+
{ "type", "EMAIL" },
|
|
179
|
+
{ "email", email },
|
|
180
|
+
};
|
|
181
|
+
Dictionary<string, object> headers = null;
|
|
182
|
+
if (riskControlData != null)
|
|
183
|
+
{
|
|
184
|
+
headers = new Dictionary<string, object>()
|
|
185
|
+
{
|
|
186
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
RequestVerifyCodeData response = null;
|
|
191
|
+
UIManager.ShowLoading(true);
|
|
192
|
+
try
|
|
193
|
+
{
|
|
194
|
+
loginAlert?.SetSendButtonEnable(false);
|
|
195
|
+
response = (await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(XDG_LOGIN_CODE_SEND, headers: headers, data: data))?.Data;
|
|
196
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
197
|
+
if (response != null) loginAlert?.UpdateCanResendSeconds(response.ReSendInterval);
|
|
198
|
+
AliyunTrack.SendEmailCode(true);
|
|
199
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString()?.CodeSendSuccess);
|
|
200
|
+
}
|
|
201
|
+
catch (XDGError e)
|
|
202
|
+
{
|
|
203
|
+
AliyunTrack.SendEmailCode(false);
|
|
204
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
205
|
+
if (e.Code == RISK_CONTROL || e.Code == RISK_CONTROL_FAILED)
|
|
206
|
+
{
|
|
207
|
+
TaskCompletionSource<RequestVerifyCodeData> tcs = new TaskCompletionSource<RequestVerifyCodeData>();
|
|
208
|
+
|
|
209
|
+
string scene = e.ExtraData["captcha_scene"] as string;
|
|
210
|
+
|
|
211
|
+
async void Callback(string token, XDGError error)
|
|
212
|
+
{
|
|
213
|
+
if (!string.IsNullOrEmpty(token))
|
|
214
|
+
{
|
|
215
|
+
try
|
|
216
|
+
{
|
|
217
|
+
AliyunTrack.TriggerCaptchaSuccess("login_email");
|
|
218
|
+
RequestVerifyCodeData codeData = await RequestLoginVerifyCode(email, token);
|
|
219
|
+
tcs.TrySetResult(codeData);
|
|
220
|
+
}
|
|
221
|
+
catch (XDGError exception)
|
|
222
|
+
{
|
|
223
|
+
tcs.TrySetException(exception);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else
|
|
227
|
+
{
|
|
228
|
+
tcs.TrySetException(error as XDGError ?? throw new InvalidOperationException());
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
AliyunTrack.TriggerCaptchaStart("login_email");
|
|
233
|
+
XDGCaptcha.ValidateWithCaptcha(scene, new Dictionary<string, string>(){{"eventSessionId", AliyunTrack.LoginEventSessionId}}, Callback);
|
|
234
|
+
response = await tcs.Task;
|
|
235
|
+
}
|
|
236
|
+
else if (e.Code == INVALID_EMAIL_FORMAT)
|
|
237
|
+
{
|
|
238
|
+
loginAlert?.UpdateEmailError(e.ErrorMsg);
|
|
239
|
+
}
|
|
240
|
+
else
|
|
241
|
+
{
|
|
242
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (Exception)
|
|
246
|
+
{
|
|
247
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
248
|
+
AliyunTrack.SendEmailCode(false);
|
|
249
|
+
UIManager.DismissLoading();
|
|
250
|
+
throw;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
UIManager.DismissLoading();
|
|
254
|
+
return response;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private static async Task<RequestVerifyCodeData> RequestUnbindVerifyCode(string riskControlData = null)
|
|
258
|
+
{
|
|
259
|
+
Dictionary<string, object> data = new Dictionary<string, object>
|
|
260
|
+
{
|
|
261
|
+
{ "type", "EMAIL" }
|
|
262
|
+
};
|
|
263
|
+
Dictionary<string, object> headers = null;
|
|
264
|
+
if (riskControlData != null)
|
|
265
|
+
{
|
|
266
|
+
headers = new Dictionary<string, object>()
|
|
267
|
+
{
|
|
268
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
RequestVerifyCodeData response = null;
|
|
273
|
+
try
|
|
274
|
+
{
|
|
275
|
+
unbindAlert?.SetSendButtonEnable(false);
|
|
276
|
+
response = (await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(XDG_UNBIND_CODE_SEND, headers: headers, data: data))?.Data;
|
|
277
|
+
unbindAlert?.SetSendButtonEnable(true);
|
|
278
|
+
if (response != null) unbindAlert?.UpdateCanResendSeconds(response.ReSendInterval);
|
|
279
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString()?.CodeSendSuccess);
|
|
280
|
+
}
|
|
281
|
+
catch (XDGError e)
|
|
282
|
+
{
|
|
283
|
+
unbindAlert?.SetSendButtonEnable(true);
|
|
284
|
+
if (e.Code == RISK_CONTROL || e.Code == RISK_CONTROL_FAILED)
|
|
285
|
+
{
|
|
286
|
+
TaskCompletionSource<RequestVerifyCodeData> tcs = new TaskCompletionSource<RequestVerifyCodeData>();
|
|
287
|
+
|
|
288
|
+
string scene = e.ExtraData["captcha_scene"] as string;
|
|
289
|
+
|
|
290
|
+
async void Callback(string token, XDGError error)
|
|
291
|
+
{
|
|
292
|
+
if (!string.IsNullOrEmpty(token))
|
|
293
|
+
{
|
|
294
|
+
try
|
|
295
|
+
{
|
|
296
|
+
RequestVerifyCodeData codeData = await RequestUnbindVerifyCode(token);
|
|
297
|
+
tcs.TrySetResult(codeData);
|
|
298
|
+
}
|
|
299
|
+
catch (XDGError exception)
|
|
300
|
+
{
|
|
301
|
+
tcs.TrySetException(exception);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else
|
|
305
|
+
{
|
|
306
|
+
tcs.TrySetException(error as XDGError ?? throw new InvalidOperationException());
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
XDGCaptcha.ValidateWithCaptcha(scene, new Dictionary<string, string>(){{"eventSessionId", AliyunTrack.LoginEventSessionId}}, Callback);
|
|
311
|
+
response = await tcs.Task;
|
|
312
|
+
}
|
|
313
|
+
else
|
|
314
|
+
{
|
|
315
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch (Exception)
|
|
319
|
+
{
|
|
320
|
+
unbindAlert?.SetSendButtonEnable(true);
|
|
321
|
+
UIManager.DismissLoading();
|
|
322
|
+
throw;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return response;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private static async Task LoginByEmail(string email, string code)
|
|
329
|
+
{
|
|
330
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
331
|
+
{
|
|
332
|
+
{ "type", (int)LoginType.Email },
|
|
333
|
+
{ "token", email },
|
|
334
|
+
{ "secret", code },
|
|
335
|
+
{ "subType", "text" }
|
|
336
|
+
};
|
|
337
|
+
try
|
|
338
|
+
{
|
|
339
|
+
await AccessTokenModule.Login(authData, null);
|
|
340
|
+
AliyunTrack.EmailCodeVerifyResult(true);
|
|
341
|
+
}
|
|
342
|
+
catch (XDGError e)
|
|
343
|
+
{
|
|
344
|
+
AliyunTrack.EmailCodeVerifyResult(false, e.ErrorMsg);
|
|
345
|
+
throw;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
private static async Task BindByEmail(string email, string code)
|
|
350
|
+
{
|
|
351
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
352
|
+
{
|
|
353
|
+
{ "type", (int)LoginType.Email },
|
|
354
|
+
{ "token", email },
|
|
355
|
+
{ "secret", code },
|
|
356
|
+
{ "subType", "text" }
|
|
357
|
+
};
|
|
358
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_BIND_INTERFACE, data: authData);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
private static async Task UnbindByEmail(string code)
|
|
362
|
+
{
|
|
363
|
+
Dictionary<string, object> data = new Dictionary<string, object>()
|
|
364
|
+
{
|
|
365
|
+
{ "type", (int)LoginType.Email },
|
|
366
|
+
{ "verificationCode", code }
|
|
367
|
+
};
|
|
368
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_UNBIND_INTERFACE, data: data);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
#endif
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal;
|
|
7
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
11
|
+
{
|
|
12
|
+
public class PhoneModule
|
|
13
|
+
{
|
|
14
|
+
public const int INVALID_PHONE_NUMBER_FORMAT = 40022;
|
|
15
|
+
public const int REQUEST_CODE_FREQUENTLY = 42901;
|
|
16
|
+
public const int LOGIN_REQUEST_FREQUENTLY = 42900;
|
|
17
|
+
public const int RISK_CONTROL = 40024;
|
|
18
|
+
public const int RISK_CONTROL_FAILED = 40025;
|
|
19
|
+
public const int INVALID_VERIFY_CODE = 40114;
|
|
20
|
+
public const int LOGIN_FREQUENTLY = 42900;
|
|
21
|
+
public const int INVALILD_TOKEN = 40113;
|
|
22
|
+
|
|
23
|
+
public static Task Login()
|
|
24
|
+
{
|
|
25
|
+
// 手机登录总流程
|
|
26
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
27
|
+
PhoneNumberInputAlert alert = null;
|
|
28
|
+
AliyunTrack.LoginAuthorize();
|
|
29
|
+
AliyunTrack.LoginTrackPhoneData();
|
|
30
|
+
|
|
31
|
+
alert = UIManager.ShowUI<PhoneNumberInputAlert>("XDPhoneNumberInputAlert", null, async (code, data) =>
|
|
32
|
+
{
|
|
33
|
+
if (code == PhoneNumberInputAlert.CLOSE_CODE)
|
|
34
|
+
{
|
|
35
|
+
// 关闭不结束 Task,同 Web 授权
|
|
36
|
+
UIManager.Dismiss();
|
|
37
|
+
AliyunTrack.LoginAuthorizeFail("cancel");
|
|
38
|
+
AliyunTrack.LoginFail("cancel");
|
|
39
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
40
|
+
}
|
|
41
|
+
else if (code == PhoneNumberInputAlert.NEXT_CODE)
|
|
42
|
+
{
|
|
43
|
+
// 已经拿到手机号
|
|
44
|
+
PhoneNumberInputAlert.Data input = data as PhoneNumberInputAlert.Data;
|
|
45
|
+
string areaCode = input.AreaCode;
|
|
46
|
+
string phoneNumber = input.PhoneNumber;
|
|
47
|
+
try
|
|
48
|
+
{
|
|
49
|
+
// 验证码阶段
|
|
50
|
+
await VerifyCodeInputAlert.Verify(
|
|
51
|
+
phoneNumber,
|
|
52
|
+
riskControlData => RequestLoginVerifyCode(areaCode, phoneNumber, riskControlData),
|
|
53
|
+
verificationCode => LoginByPhone(areaCode, phoneNumber, verificationCode)
|
|
54
|
+
);
|
|
55
|
+
AliyunTrack.LoginAuthorizeSuccess();
|
|
56
|
+
tcs.TrySetResult(null);
|
|
57
|
+
UIManager.Dismiss();
|
|
58
|
+
}
|
|
59
|
+
catch (XDGError e)
|
|
60
|
+
{
|
|
61
|
+
if (e.Code == INVALID_PHONE_NUMBER_FORMAT)
|
|
62
|
+
{
|
|
63
|
+
alert.CheckPhoneNumberValid(phoneNumber);
|
|
64
|
+
}
|
|
65
|
+
else if (e.Code == REQUEST_CODE_FREQUENTLY)
|
|
66
|
+
{
|
|
67
|
+
// 频繁登录
|
|
68
|
+
UIManager.ShowToast(e.Message);
|
|
69
|
+
}
|
|
70
|
+
else
|
|
71
|
+
{
|
|
72
|
+
// 其他异常
|
|
73
|
+
if (string.IsNullOrEmpty(e.Message))
|
|
74
|
+
{
|
|
75
|
+
// TODO 翻译
|
|
76
|
+
UIManager.ShowToast("发送失败");
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
{
|
|
80
|
+
UIManager.ShowToast(e.Message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (TaskCanceledException tce)
|
|
85
|
+
{
|
|
86
|
+
// 退出不处理
|
|
87
|
+
AliyunTrack.LoginAuthorizeFail(tce.Message);
|
|
88
|
+
UIManager.Dismiss();
|
|
89
|
+
AliyunTrack.LoginFail("cancel");
|
|
90
|
+
}
|
|
91
|
+
catch (Exception e)
|
|
92
|
+
{
|
|
93
|
+
AliyunTrack.LoginAuthorizeFail(e.Message);
|
|
94
|
+
UIManager.ShowToast("发送失败");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return tcs.Task;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public static Task Bind()
|
|
102
|
+
{
|
|
103
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
104
|
+
UIManager.ShowUI<PhoneNumberInputAlert>("XDPhoneNumberInputAlert", null, async (code, data) =>
|
|
105
|
+
{
|
|
106
|
+
if (code == PhoneNumberInputAlert.CLOSE_CODE)
|
|
107
|
+
{
|
|
108
|
+
UIManager.Dismiss();
|
|
109
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
110
|
+
}
|
|
111
|
+
else if (code == PhoneNumberInputAlert.NEXT_CODE)
|
|
112
|
+
{
|
|
113
|
+
try
|
|
114
|
+
{
|
|
115
|
+
PhoneNumberInputAlert.Data input = data as PhoneNumberInputAlert.Data;
|
|
116
|
+
string areaCode = input.AreaCode;
|
|
117
|
+
string phoneNumber = input.PhoneNumber;
|
|
118
|
+
await VerifyCodeInputAlert.Verify(
|
|
119
|
+
phoneNumber,
|
|
120
|
+
riskControlData => RequestLoginVerifyCode(areaCode, phoneNumber, riskControlData),
|
|
121
|
+
verificationCode => BindByPhone(areaCode, phoneNumber, verificationCode)
|
|
122
|
+
);
|
|
123
|
+
tcs.TrySetResult(null);
|
|
124
|
+
UIManager.Dismiss();
|
|
125
|
+
}
|
|
126
|
+
catch (TaskCanceledException)
|
|
127
|
+
{
|
|
128
|
+
UIManager.Dismiss();
|
|
129
|
+
}
|
|
130
|
+
catch (XDGError e)
|
|
131
|
+
{
|
|
132
|
+
if (e.Code == REQUEST_CODE_FREQUENTLY)
|
|
133
|
+
{
|
|
134
|
+
// 频繁登录
|
|
135
|
+
UIManager.ShowToast(e.Message);
|
|
136
|
+
}
|
|
137
|
+
else
|
|
138
|
+
{
|
|
139
|
+
tcs.TrySetException(e);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return tcs.Task;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public static async Task Unbind(Dictionary<string, object> extras)
|
|
148
|
+
{
|
|
149
|
+
string phoneNumber = extras["openId"] as string;
|
|
150
|
+
await VerifyCodeInputAlert.Verify(phoneNumber,
|
|
151
|
+
riskControlData => RequestUnbindVerifyCode(riskControlData),
|
|
152
|
+
code => UnbindByPhone(code));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private static async Task<RequestVerifyCodeData> RequestLoginVerifyCode(string areaCode, string phoneNumber,
|
|
156
|
+
string riskControlData = null)
|
|
157
|
+
{
|
|
158
|
+
string path = "api/login/v1/verification/code/send";
|
|
159
|
+
Dictionary<string, object> data = new Dictionary<string, object>
|
|
160
|
+
{
|
|
161
|
+
{ "areaCode", areaCode }, // 当前版本固定国内
|
|
162
|
+
{ "phoneNumber", phoneNumber }
|
|
163
|
+
};
|
|
164
|
+
Dictionary<string, object> headers = null;
|
|
165
|
+
if (riskControlData != null)
|
|
166
|
+
{
|
|
167
|
+
headers = new Dictionary<string, object>()
|
|
168
|
+
{
|
|
169
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
RequestVerifyCodeResponse response = null;
|
|
174
|
+
UIManager.ShowLoading(true);
|
|
175
|
+
try
|
|
176
|
+
{
|
|
177
|
+
response = await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(path,
|
|
178
|
+
headers: headers, data: data);
|
|
179
|
+
AliyunTrack.LoginMobileVerifyCodeSendSuccess();
|
|
180
|
+
}
|
|
181
|
+
catch (Exception)
|
|
182
|
+
{
|
|
183
|
+
UIManager.DismissLoading();
|
|
184
|
+
AliyunTrack.LoginMobileVerifyCodeSendFail();
|
|
185
|
+
throw;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
UIManager.DismissLoading();
|
|
189
|
+
return response?.Data;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private static async Task<RequestVerifyCodeData> RequestUnbindVerifyCode(string riskControlData = null)
|
|
193
|
+
{
|
|
194
|
+
string path = "api/account/v1/unbind/verification/code/send";
|
|
195
|
+
Dictionary<string, object> headers = null;
|
|
196
|
+
if (riskControlData != null)
|
|
197
|
+
{
|
|
198
|
+
headers = new Dictionary<string, object>()
|
|
199
|
+
{
|
|
200
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
RequestVerifyCodeResponse response = await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(path,
|
|
205
|
+
headers: headers);
|
|
206
|
+
return response.Data;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private static async Task LoginByPhone(string areaCode, string phoneNumber, string code)
|
|
210
|
+
{
|
|
211
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
212
|
+
{
|
|
213
|
+
{ "type", (int)LoginType.Phone },
|
|
214
|
+
{ "token", $"{areaCode} {phoneNumber}" },
|
|
215
|
+
{ "secret", code },
|
|
216
|
+
{ "subType", "text" }
|
|
217
|
+
};
|
|
218
|
+
await AccessTokenModule.Login(authData, null);
|
|
219
|
+
AliyunTrack.LoginMobileVerifyCodePassSuccess();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private static async Task BindByPhone(string areaCode, string phoneNumber, string code)
|
|
223
|
+
{
|
|
224
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
225
|
+
{
|
|
226
|
+
{ "type", (int)LoginType.Phone },
|
|
227
|
+
{ "token", $"{areaCode} {phoneNumber}" },
|
|
228
|
+
{ "secret", code },
|
|
229
|
+
{ "subType", "text" }
|
|
230
|
+
};
|
|
231
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_BIND_INTERFACE, data: authData);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private static async Task UnbindByPhone(string code)
|
|
235
|
+
{
|
|
236
|
+
Dictionary<string, object> data = new Dictionary<string, object>()
|
|
237
|
+
{
|
|
238
|
+
{ "type", (int)LoginType.Phone },
|
|
239
|
+
{ "verificationCode", code }
|
|
240
|
+
};
|
|
241
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_UNBIND_INTERFACE, data: data);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
#endif
|