This repository has been archived on 2025-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
2023-11-29 10:42:23 -05:00

49 lines
1.3 KiB
Plaintext

@namespace Oqtane.Themes.Controls
@using System.Net
@inherits ThemeControlBase
@inject IStringLocalizer<UserProfile> Localizer
@inject NavigationManager NavigationManager
<span class="app-profile">
<AuthorizeView Roles="@RoleNames.Registered">
<Authorizing>
<text>...</text>
</Authorizing>
<Authorized>
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
</Authorized>
<NotAuthorized>
@if (ShowRegister && PageState.Site.AllowRegistration)
{
<button type="button" class="btn btn-primary" @onclick="RegisterUser">@Localizer["Register"]</button>
}
</NotAuthorized>
</AuthorizeView>
</span>
@code {
[Parameter]
public bool ShowRegister { get; set; }
private string _returnurl = "";
protected override void OnParametersSet()
{
_returnurl = WebUtility.UrlEncode(PageState.Route.PathAndQuery);
}
private void RegisterUser()
{
NavigationManager.NavigateTo(NavigateUrl("register", "returnurl=" + _returnurl));
}
private void UpdateProfile()
{
NavigationManager.NavigateTo(NavigateUrl("profile", "returnurl=" + _returnurl));
}
}