Browse Source

Add landing page to AuthServer

pull/5/head
enisn 5 years ago
parent
commit
5fdb16200d
  1. 27
      apps/auth-server/src/EShopOnAbp.AuthServer/Pages/Index.cshtml
  2. 20
      apps/auth-server/src/EShopOnAbp.AuthServer/Pages/Index.cshtml.cs
  3. 4
      apps/auth-server/src/EShopOnAbp.AuthServer/Pages/_ViewImports.cshtml

27
apps/auth-server/src/EShopOnAbp.AuthServer/Pages/Index.cshtml

@ -0,0 +1,27 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using EShopOnAbp.Localization
@using EShopOnAbp.AuthServer.Pages
@using Volo.Abp.Users
@model IndexModel
@inject IHtmlLocalizer<EShopOnAbpResource> L
@inject ICurrentUser CurrentUser
<div>
<abp-row>
<abp-column size-md="_3" class="text-center">
<i class="fa fa-user d-block" style="font-size: 10em; color: #12b900"></i>
@* ReSharper disable once Mvc.ControllerNotResolved *@
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">@L["Logout"]</a>
</abp-column>
<abp-column size-md="_9">
<h2>@CurrentUser.UserName</h2>
<h5 class="text-muted">@CurrentUser.Email</h5>
<div>
<strong>Roles</strong>: @CurrentUser.Roles.JoinAsString(", ")
<br />
<strong>Claims</strong>: <br />
@Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString(" <br /> "))
</div>
</abp-column>
</abp-row>
</div>

20
apps/auth-server/src/EShopOnAbp.AuthServer/Pages/Index.cshtml.cs

@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace EShopOnAbp.AuthServer.Pages
{
public class IndexModel : AbpPageModel
{
public ActionResult OnGet()
{
if (!CurrentUser.IsAuthenticated)
{
return Redirect("~/Account/Login");
}
else
{
return Page();
}
}
}
}

4
apps/auth-server/src/EShopOnAbp.AuthServer/Pages/_ViewImports.cshtml

@ -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
Loading…
Cancel
Save