diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml index 09526ceeb..626e74bd6 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/ChangePassword.cshtml @@ -12,6 +12,8 @@

@L["ChangePassword"]

+ +
@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 @@

@L["EmailConfirm"]

+ + @L["Cancel"] diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml index 412060c4e..569d3d5ff 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Login.cshtml @@ -104,17 +104,20 @@
- -
- - - -
-
-
-
-
-
+ @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 @@

@L["Register"]

+ + @if (Model.EnableLocalRegister || Model.IsExternalLogin) { diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml.cs index 1ba76bb5f..70a1e12e5 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -29,10 +29,11 @@ namespace LINGYUN.Abp.Account.Web.Pages.Account; public class RegisterModel : AccountPageModel { - + [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/SendEmailConfirm.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendEmailConfirm.cshtml index 018dbb60c..026725e62 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendEmailConfirm.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendEmailConfirm.cshtml @@ -8,6 +8,8 @@

@L["EmailConfirm"]

+ + @L["Cancel"]