feat: add user management, refs NOISSUE
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
@{
|
||||
bool DoesUserHaveClaimedPhoneNumber()
|
||||
{
|
||||
using (var dci = DataContext.Instance)
|
||||
{
|
||||
var user = dci.Users.Where(u => u.LdapUserName == User.Identity.Name);
|
||||
return user.Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
@@ -26,9 +37,18 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/SuggestionHelpers">Suggestion Helpers</a>
|
||||
</li>
|
||||
@if (this.User.Identity.IsAuthenticated && !DoesUserHaveClaimedPhoneNumber())
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/UnclaimedPhoneNumbers">Unclaimed Phone Numbers</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" style="min-height: auto; width: 400px;">
|
||||
<partial name="_LoginView" />
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
|
36
song_of_the_day/Pages/Shared/_LoginView.cshtml
Normal file
36
song_of_the_day/Pages/Shared/_LoginView.cshtml
Normal file
@@ -0,0 +1,36 @@
|
||||
@using Microsoft.AspNetCore.Authentication
|
||||
|
||||
<div class="loginform">
|
||||
@if (!this.User.Identity.IsAuthenticated)
|
||||
{
|
||||
<form method="post" action="Auth/Login">
|
||||
<div>
|
||||
<label for="username">Username:</label>
|
||||
</div>
|
||||
<div>
|
||||
<input name="username" type="text" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="password">Password:</label>
|
||||
</div>
|
||||
<div>
|
||||
<input name="password" type="password" />
|
||||
</div>
|
||||
<div>
|
||||
<input name="submit" type="submit" value="Login" />
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form method="post" action="Auth/Logout">
|
||||
<div>
|
||||
Welcome, @User.Identity.Name!
|
||||
</div>
|
||||
<div>
|
||||
<input name="submit" type="submit" value="Logout" />
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user