令牌账号导入逻辑和提示优化

This commit is contained in:
RMBGAME
2021-10-27 16:32:38 +08:00
parent 24d30b52ca
commit 0abd04bb76
5 changed files with 65 additions and 40 deletions
@@ -152,28 +152,31 @@
</Button>
</StackPanel>
<ItemsRepeater Items="{Binding CardsFarmer.CurrentGamesFarmingReadOnly}">
<ItemsRepeater.Layout>
<StackLayout Orientation="Horizontal" Spacing="10">
</StackLayout>
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border>
<Panel>
<Image Source="{Binding ImageUrl,Converter={StaticResource BitmapAssetValueConverter}}"
Width="184"
Stretch="Uniform"/>
<TextBlock Text="{Binding GameName}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
TextAlignment="Center"/>
</Panel>
</Border>
<ScrollViewer VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Auto"
HorizontalAlignment="Left">
<ItemsRepeater Items="{Binding CardsFarmer.CurrentGamesFarmingReadOnly}">
<ItemsRepeater.Layout>
<StackLayout Orientation="Horizontal" Spacing="10"/>
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border>
<Panel>
<Image Source="{Binding ImageUrl,Converter={StaticResource BitmapAssetValueConverter}}"
Width="184"
Stretch="Uniform"/>
<TextBlock Text="{Binding GameName}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
TextAlignment="Center"/>
</Panel>
</Border>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
</Panel>
</Grid>
+10 -1
View File
@@ -2692,6 +2692,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 你已经成功通过账号登录导入了你的令牌,请最后在测试一下你的令牌是否可以正常使用,如果无法使用可能导入失败,尝试重新进行导入并且删除掉无效令牌即可。 的本地化字符串。
/// </summary>
public static string LocalAuth_SteamUserImportSuccess {
get {
return ResourceManager.GetString("LocalAuth_SteamUserImportSuccess", resourceCulture);
}
}
/// <summary>
/// 查找类似 设备ID(uuid): 的本地化字符串。
/// </summary>
@@ -3026,7 +3035,7 @@ namespace System.Application.UI.Resx {
}
/// <summary>
/// 查找类似 您的身份验证器已被添加到您的Steam账户上并已经成功导入Steam++。这是您的恢复代码,如果您丢失了身份验证器,可以用它从您的账户中删除。请您现在就写下它,并将其放在安全的地方。 的本地化字符串。
/// 查找类似 您的令牌已被添加到您的Steam账户上并已经成功导入Steam++。这是您的恢复代码,如果您丢失了身份验证器,可以用它从您的账户中删除。请您现在就写下它,并将其放在安全的地方。 的本地化字符串。
/// </summary>
public static string RecoveryCode_RememberTip {
get {
+4 -1
View File
@@ -889,6 +889,9 @@
<data name="LocalAuth_SteamUserImport" xml:space="preserve">
<value>Steam账号导入</value>
</data>
<data name="LocalAuth_SteamUserImportSuccess" xml:space="preserve">
<value>你已经成功通过账号登录导入了你的令牌,请最后在测试一下你的令牌是否可以正常使用,如果无法使用可能导入失败,尝试重新进行导入并且删除掉无效令牌即可。</value>
</data>
<data name="LocalAuth_SteamUser_Error" xml:space="preserve">
<value>无法将添加身份验证器添加到您的帐户, 请稍后再试。</value>
</data>
@@ -971,7 +974,7 @@
<value>我已经写下了我的恢复代码</value>
</data>
<data name="RecoveryCode_RememberTip" xml:space="preserve">
<value>您的身份验证器已被添加到您的Steam账户上并已经成功导入Steam++。这是您的恢复代码,如果您丢失了身份验证器,可以用它从您的账户中删除。请您现在就写下它,并将其放在安全的地方。</value>
<value>您的令牌已被添加到您的Steam账户上并已经成功导入Steam++。这是您的恢复代码,如果您丢失了身份验证器,可以用它从您的账户中删除。请您现在就写下它,并将其放在安全的地方。</value>
</data>
<data name="Refresh" xml:space="preserve">
<value>刷新</value>
@@ -220,8 +220,8 @@ namespace System.Application.UI.ViewModels
}
}
private Stream? _CaptchaImage;
public Stream? CaptchaImage
private string? _CaptchaImage;
public string? CaptchaImage
{
get => _CaptchaImage;
set => this.RaiseAndSetIfChanged(ref _CaptchaImage, value);
@@ -305,6 +305,7 @@ namespace System.Application.UI.ViewModels
//ToastService.Current.Notify(_Enroll.Error);
}
//已有令牌无法导入
if (_Enroll.Requires2FA == true)
{
MessageBox.Show(AppResources.LocalAuth_SteamUser_Requires2FA);
@@ -312,17 +313,19 @@ namespace System.Application.UI.ViewModels
return;
}
//频繁登录会需要验证码
if (_Enroll.RequiresCaptcha == true)
{
CaptchaText = null;
CaptchaImage = null;
using var web = new WebClient();
var bt = web.DownloadData(_Enroll.CaptchaUrl);
using var stream = new MemoryStream(bt);
CaptchaImage = stream;
//using var web = new WebClient();
//var bt = web.DownloadData(_Enroll.CaptchaUrl);
//using var stream = new MemoryStream(bt);
CaptchaImage = _Enroll.CaptchaUrl;
return;
}
//需要邮箱验证
if (_Enroll.RequiresEmailAuth == true)
{
RequiresLogin = false;
@@ -332,18 +335,13 @@ namespace System.Application.UI.ViewModels
return;
}
//需要短信验证 此步骤导入还没有结束
if (_Enroll.RequiresActivation == true)
{
EmailDomain = null;
_Enroll.Error = null;
RequiresLogin = false;
AuthService.Current.AddOrUpdateSaveAuthenticators(new GAPAuthenticatorDTO
{
Name = nameof(GamePlatform.Steam) + "(" + UserName + ")",
Value = _SteamAuthenticator
}, AuthIsLocal, AuthPassword);
RequiresActivation = true;
RevocationCode = _Enroll.RevocationCode;
return;
@@ -362,8 +360,20 @@ namespace System.Application.UI.ViewModels
MessageBox.Show(_Enroll.Error!);
return;
}
RequiresActivation = false;
RequiresAdd = true;
else
{
RequiresActivation = false;
RequiresAdd = true;
//导入成功,添加令牌
AuthService.Current.AddOrUpdateSaveAuthenticators(new GAPAuthenticatorDTO
{
Name = nameof(GamePlatform.Steam) + "(" + UserName + ")",
Value = _SteamAuthenticator
}, AuthIsLocal, AuthPassword);
Toast.Show(AppResources.LocalAuth_SteamUserImportSuccess);
}
}).ContinueWith(s =>
{
Log.Error(nameof(AddAuthWindowViewModel), s.Exception, nameof(LoginSteamImport));
@@ -472,7 +472,7 @@ namespace System.Application.Models
state.OAuthToken = null; // force new login
state.RequiresLogin = true;
state.Cookies = null;
state.Error = "您的Steam帐户必须附有支持短信的电话号码, " + Environment.NewLine + "请到Steam客户端或Steam网站的帐户详细信息添加电话号码。";
state.Error = "您的Steam帐户必须附有支持短信的手机号码, " + Environment.NewLine + "请到Steam客户端或Steam网站的帐户详细信息添加电话号码。";
return false;
}
@@ -494,7 +494,7 @@ namespace System.Application.Models
state.OAuthToken = null; // force new login
state.RequiresLogin = true;
state.Cookies = null;
state.Error = "无法发送短信, 检查您的电话已在您的Steam帐户中注册。";
state.Error = "无法发送短信,检查您的手机号已在您的Steam帐户中注册。";
return false;
}
if (response.IndexOf("shared_secret") == -1)
@@ -582,7 +582,7 @@ namespace System.Application.Models
}
if (state.RequiresActivation == true)
{
state.Error = "注册时出现问题!Steam服务器可能存在问题, 请稍后再试。";
state.Error = "注册时出现问题!Steam服务器可能存在问题,请稍后再试。";
return false;
}