Added basic authentication and localization
This commit is contained in:
28
src/Server/Views/Account/Login.cshtml
Normal file
28
src/Server/Views/Account/Login.cshtml
Normal file
@@ -0,0 +1,28 @@
|
||||
@using Server.Services
|
||||
@inject LocalizationService T
|
||||
@{
|
||||
ViewData["Title"] = "Login";
|
||||
var returnUrl = ViewData["ReturnUrl"] as string;
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1>Login</h1>
|
||||
<form asp-action="Login" method="post" class="mt-4" style="max-width: 400px; margin: auto;">
|
||||
<div class="form-group mb-3">
|
||||
<label for="username" class="form-label">@T["Username"]</label>
|
||||
<input autofocus type="text" class="form-control" id="username" name="username" autocomplete="username" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="password" class="form-label">@T["Password"]</label>
|
||||
<input type="password" class="form-control" id="password" name="password" autocomplete="current-password" required>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100">@T["Login"]</button>
|
||||
|
||||
@if (!ViewData.ModelState.IsValid)
|
||||
{
|
||||
<p style="color:red">Invalid username or password</p>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
@@ -19,12 +19,21 @@
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
@if (User.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Logout">Logout</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user