1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added 'Premium' badge to navbar if the user is a premium user.

This commit is contained in:
Uncled1023 2021-07-14 23:04:01 -07:00
parent d02ed91220
commit c19601716c

View File

@ -1,8 +1,19 @@
@if (Config.UserConfig.RegistrationEnabled || Config.UserConfig.LoginEnabled)
{
<div class="nav navbar-nav navbar-right">
<ul class="nav navbar-nav navbar-right">
@if (User.Identity.IsAuthenticated)
{
var accountTypeString = User.FindFirst("account-type").Value;
if (!string.IsNullOrEmpty(accountTypeString))
{
if (Enum.TryParse(accountTypeString, out AccountType accountType) &&
accountType == AccountType.Premium)
{
<p class="navbar-text">
<span class="badge bg-primary">Premium</span>
</p>
}
}
<li class="dropdown">
<a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name <strong class="caret"></strong></a>
<ul class="dropdown-menu dropdown-left-manual" role="menu" aria-labelledby="user_menu">
@ -49,5 +60,5 @@
<a href="@Url.SubRouteUrl("account", "User.Login", new { returnUrl = @Context.Request.GetDisplayUrl() })" class="btn btn-default navbar-btn">Log In</a>
}
}
</div>
</ul>
}