mirror of https://github.com/abpframework/abp.git
6 changed files with 94 additions and 4 deletions
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.Authentication; |
|||
|
|||
namespace MyCompanyName.MyProjectName.Controllers |
|||
{ |
|||
public class AccountController : ChallengeAccountController |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Localization.Resources.AbpUi; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using MyCompanyName.MyProjectName.Localization; |
|||
using Volo.Abp.UI.Navigation; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace MyCompanyName.MyProjectName |
|||
{ |
|||
public class MyProjectNameWebHostMenuContributor : IMenuContributor |
|||
{ |
|||
private readonly IConfiguration _configuration; |
|||
|
|||
public MyProjectNameWebHostMenuContributor(IConfiguration configuration) |
|||
{ |
|||
_configuration = configuration; |
|||
} |
|||
|
|||
public Task ConfigureMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (context.Menu.Name == StandardMenus.User) |
|||
{ |
|||
AddLogoutItemToMenu(context); |
|||
} |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
private void AddLogoutItemToMenu(MenuConfigurationContext context) |
|||
{ |
|||
var currentUser = context.ServiceProvider.GetRequiredService<ICurrentUser>(); |
|||
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<MyProjectNameResource>>(); |
|||
|
|||
if (currentUser.IsAuthenticated) |
|||
{ |
|||
context.Menu.Items.Add(new ApplicationMenuItem( |
|||
"Account.Manage", |
|||
l["ManageYourProfile"], |
|||
$"{_configuration["AuthServer:Authority"].EnsureEndsWith('/')}Account/Manage", |
|||
icon: "fa fa-cog", |
|||
order: int.MaxValue - 1001, |
|||
null, |
|||
"_blank") |
|||
); |
|||
|
|||
|
|||
context.Menu.Items.Add(new ApplicationMenuItem( |
|||
"Account.Logout", |
|||
l["Logout"], |
|||
"/Account/Logout", |
|||
"fas fa-power-off", |
|||
order: int.MaxValue - 1000 |
|||
)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,6 +1,6 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
|
|||
"ManageYourProfile": "Manage your profile" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"ManageYourProfile": "Profil yönetimi" |
|||
} |
|||
} |
|||
Loading…
Reference in new issue