49 lines
1.3 KiB
Plaintext
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));
|
|
}
|
|
}
|
|
|
|
|