Skip to content

Commit 93a6dd0

Browse files
authored
Simplify the Login and LoginForm views (OrchardCMS#17390)
1 parent 192b926 commit 93a6dd0

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

src/OrchardCore.Modules/OrchardCore.Users/Views/Account/Login.cshtml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
@using Microsoft.AspNetCore.Identity
2-
@using OrchardCore.DisplayManagement.ModelBinding
3-
@using OrchardCore.Entities
4-
@using OrchardCore.Settings
5-
@using OrchardCore.Users
62
@using OrchardCore.Users.Models
73

84
@inject SignInManager<IUser> SignInManager
9-
@inject UserManager<IUser> UserManager
10-
@inject IDisplayManager<LoginForm> LoginFormDisplayManager
11-
@inject IUpdateModelAccessor UpdateModelAccessor
125

136
@{
147
ViewLayout = "Layout__Login";
158

16-
var loginProviders = (await SignInManager.GetExternalAuthenticationSchemesAsync()).ToList();
9+
var loginProviders = await SignInManager.GetExternalAuthenticationSchemesAsync();
1710
var disableLocalLogin = Site.As<LoginSettings>().DisableLocalLogin;
11+
var hasExternalProviders = loginProviders.Any();
1812
}
1913

2014
<script asp-name="font-awesome" at="Foot" version="6"></script>
@@ -29,12 +23,15 @@
2923

3024
@if (!disableLocalLogin)
3125
{
32-
<div class="col-md-6 @(loginProviders.Count == 0 ? "offset-md-3" : string.Empty)">
26+
<div class="col-md-6 @(!hasExternalProviders ? "offset-md-3" : string.Empty)">
27+
<h1 class="fs-4">@T["Log in"]</h1>
28+
<hr />
29+
3330
@await DisplayAsync(Model)
3431
</div>
3532
}
3633

37-
@if (loginProviders.Count > 0)
34+
@if (hasExternalProviders)
3835
{
3936
<div class="col-md-6 @(disableLocalLogin ? "offset-md-3" : string.Empty)">
4037
<section>

src/OrchardCore.Modules/OrchardCore.Users/Views/LoginForm.Edit.cshtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
2-
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="auth-form no-multisubmit">
3-
<h1 class="fs-4">@T["Log in"]</h1>
4-
<hr />
1+
<form asp-controller="Account" asp-action="Login" asp-area="OrchardCore.Users" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="auth-form no-multisubmit">
52

63
@if (Model.Content != null)
74
{

src/docs/releases/3.0.0.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ will return `false` for administrators, even though they still have full access.
102102
{% assign isAuthorized = User | has_permission: "AccessAdminPanel" %}
103103
```
104104

105+
#### LoginForm_Edit Shape Type Modification
106+
107+
To simplify the `LoginForm.Edit.cshtml` view, the following code has been moved to `Views/Account/Login.cshtml`:
108+
109+
```html
110+
<h1 class="fs-4">@T["Log in"]</h1>
111+
<hr />
112+
```
113+
114+
If you are overriding the `Views/Account/Login.cshtml` view, you may want to add the above code to your custom version for consistency.
115+
105116
### ReCaptcha
106117

107118
In the previous implementation, the ReCaptcha module supported two modes: `AlwaysShow` and `PreventRobots`. To simplify the module and enhance integration, the `PreventRobots` mode and its related components have been removed. Going forward, **only the `AlwaysShow` mode** will be supported.

0 commit comments

Comments
 (0)