Created
July 29, 2022 15:28
-
-
Save gterdem/878ea99edaf998bb9f360bbf1a674a87 to your computer and use it in GitHub Desktop.
v6.0.0-rc.1 AuthServer Index Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page | |
@using Microsoft.AspNetCore.Mvc.Localization | |
@using Microsoft.AspNetCore.Http.Extensions | |
@using MyApplication.Localization | |
@using MyApplication.Pages | |
@using Volo.Abp.Account.Localization | |
@using Volo.Abp.Users | |
@using Volo.Abp.AspNetCore.Mvc.UI.Theming | |
@using Volo.Abp.Ui.Branding | |
@model IndexModel | |
@inject IHtmlLocalizer<MyApplicationResource> L | |
@inject IHtmlLocalizer<AccountResource> AccountLocalizer | |
@inject ICurrentUser CurrentUser | |
@inject IBrandingProvider BrandingProvider | |
@inject ITheme Theme | |
@{ | |
Layout = Theme.GetEmptyLayout(); | |
} | |
<div class="d-flex align-items-center" style="min-height: 100vh;"> | |
<div class="container"> | |
<abp-row> | |
<div class="col mx-auto account-column"> | |
<div class="account-brand p-4 text-center mb-1"> | |
@if (!BrandingProvider.LogoUrl.IsNullOrEmpty()) | |
{ | |
<a class="navbar-brand" href="/" alt="@BrandingProvider.AppName"></a> | |
} | |
else | |
{ | |
<h1>@BrandingProvider.AppName</h1> | |
} | |
</div> | |
<abp-card> | |
<abp-card-body> | |
<div class="container"> | |
<abp-row> | |
<abp-column size="_9"> | |
<div class="d-flex align-items-center"> | |
@if (CurrentUser.IsAuthenticated) | |
{ | |
<div class="me-3"> | |
<img src="/api/account/profile-picture-file/@CurrentUser.Id" class="rounded-circle" width="58" height="58" alt="Profile Picture" /> | |
</div> | |
<div> | |
<span class="fs-16"> | |
@L["Welcome"] <span class="fw-7">@CurrentUser.UserName</span> | |
</span> | |
<span class="fs-14 d-block text-dark-800 opacity-75 mb-1">@CurrentUser.Email</span> | |
<div> | |
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account">@L["MyAccount"]</a> | |
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">@L["Logout"]</a> | |
</div> | |
</div> | |
} | |
else | |
{ | |
<div class="text-center"> | |
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a> | |
</div> | |
} | |
</div> | |
</abp-column> | |
<abp-column size="_3"> | |
<div class="ml-auto p-2 float-end"> | |
<abp-dropdown> | |
<abp-dropdown-button text="@Model.CurrentLanguage" /> | |
<abp-dropdown-menu> | |
@foreach (var language in Model.Languages) | |
{ | |
<abp-dropdown-item href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@(System.Net.WebUtility.UrlEncode(Request.GetEncodedPathAndQuery()))">@language.DisplayName</abp-dropdown-item> | |
} | |
</abp-dropdown-menu> | |
</abp-dropdown> | |
</div> | |
</abp-column> | |
</abp-row> | |
<hr class="m-4" /> | |
<abp-row> | |
@foreach (var application in Model.Applications) | |
{ | |
<abp-column size-md="_4" class="mb-2"> | |
<a href="@application.ClientUri" style="text-decoration:none"> | |
<abp-card> | |
<abp-card-body> | |
@if (!application.LogoUri.IsNullOrEmpty()) | |
{ | |
<div class="mx-auto"> | |
<img src="@application.LogoUri" style="height:64px" class="mb-3" /> | |
</div> | |
} | |
<h4>@application.DisplayName</h4> | |
<span class="text-muted">@application.ClientUri</span> | |
</abp-card-body> | |
</abp-card> | |
</a> | |
</abp-column> | |
} | |
</abp-row> | |
</div> | |
</abp-card-body> | |
</abp-card> | |
</div> | |
</abp-row> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Threading.Tasks; | |
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; | |
using Volo.Abp.Localization; | |
using Volo.Abp.OpenIddict.Applications; | |
namespace MyApplication.Pages; | |
public class IndexModel : AbpPageModel | |
{ | |
public List<OpenIddictApplication> Applications { get; protected set; } | |
public IReadOnlyList<LanguageInfo> Languages { get; protected set; } | |
public string CurrentLanguage { get; protected set; } | |
protected IOpenIddictApplicationRepository OpenIdApplicationRepository { get; } | |
protected ILanguageProvider LanguageProvider { get; } | |
public IndexModel(IOpenIddictApplicationRepository openIdApplicationmRepository, ILanguageProvider languageProvider) | |
{ | |
OpenIdApplicationRepository = openIdApplicationmRepository; | |
LanguageProvider = languageProvider; | |
} | |
public async Task OnGetAsync() | |
{ | |
Applications = await OpenIdApplicationRepository.GetListAsync(); | |
Languages = await LanguageProvider.GetLanguagesAsync(); | |
CurrentLanguage = CultureInfo.CurrentCulture.DisplayName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment