mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-26 20:16:15 +08:00
Fixing that the OpenId User shape template has hidden the password change for local users too
This commit is contained in:
@@ -227,6 +227,7 @@
|
||||
<Compile Include="Providers\Google.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Services\AzureActiveDirectory\IAzureActiveDirectoryService.cs" />
|
||||
<Compile Include="Services\IOpenIdAuthenticationService.cs" />
|
||||
<Compile Include="Services\Twitter\MissingSettingsBanner.cs" />
|
||||
<Compile Include="Services\AzureActiveDirectory\MissingSettingsBanner.cs" />
|
||||
<Compile Include="Services\AzureActiveDirectory\InMemoryCache.cs" />
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Orchard.OpenId.Services {
|
||||
public interface IOpenIdAuthenticationService : IDependency {
|
||||
bool IsLocalUser();
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using Orchard.Services;
|
||||
|
||||
namespace Orchard.OpenId.Services {
|
||||
[OrchardFeature("Orchard.OpenId")]
|
||||
public class OpenIdAuthenticationService : IAuthenticationService {
|
||||
public class OpenIdAuthenticationService : IAuthenticationService, IOpenIdAuthenticationService {
|
||||
private readonly ShellSettings _settings;
|
||||
private readonly IClock _clock;
|
||||
private readonly IMembershipService _membershipService;
|
||||
@@ -103,7 +103,7 @@ namespace Orchard.OpenId.Services {
|
||||
return _localAuthenticationUser = localUser;
|
||||
}
|
||||
|
||||
private bool IsLocalUser() {
|
||||
public bool IsLocalUser() {
|
||||
var httpContext = _httpContextAccessor.Current();
|
||||
|
||||
if (httpContext.IsBackgroundContext()) {
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
<div class="user-display">
|
||||
@using System.Web.Mvc;
|
||||
|
||||
<div class="user-display">
|
||||
@if (WorkContext.CurrentUser != null) {
|
||||
IHtmlString userNameDisplayHtml;
|
||||
|
||||
if (WorkContext.Resolve<Orchard.OpenId.Services.IOpenIdAuthenticationService>().IsLocalUser()) {
|
||||
userNameDisplayHtml = Html.Raw("<a href=\"" + @Url.Action("ChangePassword", new { Controller = "Account", Area = "Orchard.Users" }) + "\">" + Html.ItemDisplayText(WorkContext.CurrentUser) + "</a>");
|
||||
}
|
||||
else {
|
||||
userNameDisplayHtml = Html.ItemDisplayText(WorkContext.CurrentUser);
|
||||
}
|
||||
|
||||
<span class="user-actions welcome">
|
||||
@T("Welcome, <strong>{0}</strong>!", Html.ItemDisplayText(WorkContext.CurrentUser))
|
||||
@T("Welcome, <strong>{0}</strong>!", userNameDisplayHtml)
|
||||
</span>
|
||||
<span class="user-actions">
|
||||
@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }, new { rel = "nofollow" })
|
||||
|
||||
Reference in New Issue
Block a user