mirror of https://github.com/abpframework/abp.git
committed by
GitHub
19 changed files with 98 additions and 39 deletions
@ -0,0 +1,39 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public class BlogUserSynchronizer : |
||||
|
IDistributedEventHandler<EntityUpdatedEto<UserEto>>, |
||||
|
ITransientDependency |
||||
|
{ |
||||
|
protected IBlogUserRepository UserRepository { get; } |
||||
|
protected IBlogUserLookupService UserLookupService { get; } |
||||
|
|
||||
|
public BlogUserSynchronizer(IBlogUserRepository userRepository, IBlogUserLookupService userLookupService) |
||||
|
{ |
||||
|
UserRepository = userRepository; |
||||
|
UserLookupService = userLookupService; |
||||
|
} |
||||
|
|
||||
|
public async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData) |
||||
|
{ |
||||
|
var user = await UserRepository.FindAsync(eventData.Entity.Id); |
||||
|
if (user == null) |
||||
|
{ |
||||
|
//TODO: Why needed (ask to @ebicoglu)?
|
||||
|
user = await UserLookupService.FindByIdAsync(eventData.Entity.Id); |
||||
|
if (user == null) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
user.Update(eventData.Entity); |
||||
|
await UserRepository.UpdateAsync(user); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,4 +1,17 @@ |
|||||
@page |
@page |
||||
|
@using Volo.Abp.Users |
||||
@model PublicWebSite.Host.Pages.IndexModel |
@model PublicWebSite.Host.Pages.IndexModel |
||||
|
@inject ICurrentUser CurrentUser |
||||
<h1>Public Web Site Application</h1> |
<h1>Public Web Site Application</h1> |
||||
<h2 class="lead">Welcome...</h2> |
<h2 class="lead">Welcome...</h2> |
||||
|
|
||||
|
@if (CurrentUser.IsAuthenticated) |
||||
|
{ |
||||
|
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">Logout</a> |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
<form method="POST"> |
||||
|
<input type="submit" asp-page-handler="Login" value="Login" /> |
||||
|
</form> |
||||
|
} |
||||
@ -1,16 +1,19 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Mvc; |
using Microsoft.AspNetCore.Authentication; |
||||
using Microsoft.AspNetCore.Mvc.RazorPages; |
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
||||
|
|
||||
namespace PublicWebSite.Host.Pages |
namespace PublicWebSite.Host.Pages |
||||
{ |
{ |
||||
public class IndexModel : PageModel |
public class IndexModel : AbpPageModel |
||||
{ |
{ |
||||
public void OnGet() |
public void OnGet() |
||||
{ |
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async Task OnPostLoginAsync() |
||||
|
{ |
||||
|
await HttpContext.ChallengeAsync("oidc"); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
||||
|
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
||||
|
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
||||
|
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
||||
|
After Width: | Height: | Size: 400 KiB |
Loading…
Reference in new issue