@if (!Model.HideOldPasswordInput)
{
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml.cs
index 9d54fb631..730624c8d 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml.cs
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml.cs
@@ -54,9 +54,11 @@ public class ChangePasswordModel : AccountPageModel
[BindProperty]
public ChangePasswordInputModel Input { get; set; }
+ [HiddenInput]
[BindProperty(SupportsGet = true)]
public string ReturnUrl { get; set; }
+ [HiddenInput]
[BindProperty(SupportsGet = true)]
public string ReturnUrlHash { get; set; }
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/EmailConfirm.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/EmailConfirm.cshtml
index 1e5aa47f9..2de79383b 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/EmailConfirm.cshtml
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/EmailConfirm.cshtml
@@ -8,6 +8,8 @@
-
-
-
+ @if (Model.QrCodeLoginInput.IsEnabled)
+ {
+
+
+
+ }
}
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml.cs
index 4c14d1399..59b8439fd 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml.cs
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml.cs
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using MyCSharp.HttpUserAgentParser.Providers;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -65,6 +66,7 @@ public class LoginModel : AccountPageModel
protected IIdentityUserRepository UserRepository => LazyServiceProvider.LazyGetRequiredService
();
protected IQrCodeLoginProvider QrCodeLoginProvider => LazyServiceProvider.LazyGetRequiredService();
+ protected IHttpUserAgentParserProvider HttpUserAgentParserProvider => LazyServiceProvider.LazyGetRequiredService();
protected IExternalProviderService ExternalProviderService { get; }
protected IAuthenticationSchemeProvider SchemeProvider { get; }
@@ -103,6 +105,8 @@ public class LoginModel : AccountPageModel
ReturnUrlHash = ReturnUrlHash,
};
+ AllowQrCodeLoginIfNotMobileDevice();
+
ExternalProviders = await GetExternalProviders();
EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin);
@@ -596,6 +600,18 @@ public class LoginModel : AccountPageModel
Alerts.Danger(L["InvalidUserNameOrPassword"]);
return Task.FromResult(Page());
}
+
+ protected virtual void AllowQrCodeLoginIfNotMobileDevice()
+ {
+ if (HttpContext?.Request?.Headers?.UserAgent.IsNullOrEmpty() == false)
+ {
+ var userAgentInfo = HttpUserAgentParserProvider.Parse(HttpContext.Request.Headers.UserAgent);
+ if (userAgentInfo.MobileDeviceType.IsNullOrWhiteSpace())
+ {
+ QrCodeLoginInput.IsEnabled = true;
+ }
+ }
+ }
}
public abstract class LoginInputModel
@@ -642,6 +658,9 @@ public class QrCodeLoginInputModel : LoginInputModel
{
[HiddenInput]
public string Key { get; set; }
+
+ [HiddenInput]
+ public bool IsEnabled { get; set; }
}
public enum LoginType
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml
index e72e79491..539a1c36c 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml
@@ -8,6 +8,8 @@