diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml index db9f1f100a..2bd2ff4677 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml @@ -1,34 +1,119 @@ @page +@using Microsoft.AspNetCore.Http.Extensions +@using Microsoft.AspNetCore.Mvc.Localization @using MyCompanyName.MyProjectName.Pages +@using MyCompanyName.MyProjectName.Localization @using Volo.Abp.Users +@using Volo.Abp.AspNetCore.Mvc.UI.Theming +@using Volo.Abp.Ui.Branding @model IndexModel +@inject IHtmlLocalizer L @inject ICurrentUser CurrentUser -@if (CurrentUser.IsAuthenticated) -{ -
+@inject IBrandingProvider BrandingProvider +@inject ITheme Theme + +@{ + Layout = Theme.GetEmptyLayout(); +} + +
+
- - - Logout - - -

@CurrentUser.UserName

-
@CurrentUser.Email
-
- Roles: @CurrentUser.Roles.JoinAsString(", ") -
- Claims:
- @Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString("
")) + + -} + + + + +
+ + + +
+
+ +
+
+ @if (CurrentUser.IsAuthenticated) + { + + @L["Welcome"] @CurrentUser.UserName + + @CurrentUser.Email + + } + else + { + @L["Login"] + } +
-@if (!CurrentUser.IsAuthenticated) -{ -
-

- Login +
+ + +
+ + + + @foreach (var language in Model.Languages) + { + @language.DisplayName + } + + +
+
+ + +
+ + + + @foreach (var application in Model.Applications) + { + + + + + @if (!application.LogoUri.IsNullOrEmpty()) + { +
+ +
+ } + +

@application.DisplayName

+ @application.ClientUri + +
+
+
+ } + +
+
+ + + + +
+ +
-} +
\ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs index e8230ee00c..f873648b3a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs @@ -1,10 +1,37 @@ +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Localization; +using Volo.Abp.OpenIddict.Applications; namespace MyCompanyName.MyProjectName.Pages; public class IndexModel : AbpPageModel { - public void OnGet() + public List Applications { get; protected set; } + + public IReadOnlyList 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() + { + var cts = new CancellationTokenSource(30); + Applications = await OpenIdApplicationRepository.GetListAsync(); + + Languages = await LanguageProvider.GetLanguagesAsync(); + CurrentLanguage = CultureInfo.CurrentCulture.DisplayName; } }