Adds authorization roles administrator dashboard

This commit is contained in:
BinaryAlley committed 2024-12-18 13:12:42 +02:00
1 parent 290af03c83
commit 1df31515fb
191 files changed
+6189 -806

No files matched your search

@@ -16,62 +16,65 @@
@model LoginRequestModel
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-50 mb-10" style="min-width: 320px; margin-top: 1rem;">
<div class="shine-effect"></div>
<form method="post" id="login-form" class="inline">
@Html.AntiForgeryToken()
<input type="hidden" name="ReturnUrl" value="@ViewData["ReturnUrl"]" />
<div class="form-container">
<!-- Username -->
<div class="form-row">
<div class="form-label">
<label asp-for="Username">@_localizer["Username"]</label>:
<div style="display: grid; grid-template-rows: auto 1fr;"> <!--container with two rows, one fixed, one filling remaining space-->
<div style ="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="login-form" class="inline">
@Html.AntiForgeryToken()
<input type="hidden" name="ReturnUrl" value="@ViewData["ReturnUrl"]" />
<div class="form-container">
<!-- Username -->
<div class="form-row">
<div class="form-label">
<label asp-for="Username">@_localizer["Username"]</label>:
</div>
<div class="form-field">
<input asp-for="Username" autocomplete="username" class="enlightenment-input" />
</div>
</div>
<div class="form-field">
<input asp-for="Username" autocomplete="username" class="enlightenment-input" />
<!-- Password -->
<div class="form-row">
<div class="form-label">
<label asp-for="Password">@_localizer["Password"]</label>:
</div>
<div class="form-field">
<input type="password" asp-for="Password" autocomplete="current-password" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button id="btn-recover-password" type="button" class="abort-button h-22px">@_localizer["RecoverPassword"]</button>
<button id="btn-login" type="submit" class="confirm-button h-22px">@_localizer["LoginKey"]</button>
</div>
<!-- 2FA -->
<div class="form-row mt-10 hidden" id="div-totp-code">
<div class="form-label">
<label asp-for="TotpCode">@_localizer["TotpCode"]</label>
</div>
<div class="form-field">
<input type="number" asp-for="TotpCode" autocomplete="one-time-code" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button type="submit" id="btn-validate-totp" class="confirm-button h-22px hidden">@_localizer["ValidateCode"]</button>
</div>
</div>
<!-- Password -->
<div class="form-row">
<div class="form-label">
<label asp-for="Password">@_localizer["Password"]</label>:
</div>
<div class="form-field">
<input type="password" asp-for="Password" autocomplete="current-password" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button id="btn-recover-password" type="button" class="abort-button h-22px">@_localizer["RecoverPassword"]</button>
<button id="btn-login" type="submit" class="confirm-button h-22px">@_localizer["LoginKey"]</button>
</div>
<!-- 2FA -->
<div class="form-row mt-10 hidden" id="div-totp-code">
<div class="form-label">
<label asp-for="TotpCode">@_localizer["TotpCode"]</label>
</div>
<div class="form-field">
<input type="number" asp-for="TotpCode" autocomplete="one-time-code" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button type="submit" id="btn-validate-totp" class="confirm-button h-22px hidden">@_localizer["ValidateCode"]</button>
</div>
</div>
</form>
</form>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
document.getElementById('login-form').addEventListener('keypress', async (event) => {
if (event.key === 'Enter') {
event.preventDefault();
const form = event.target.closest('form');
document.getElementById('login-form').addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
const form = e.target.closest('form');
await handleLogin(form);
}
});
document.getElementById('login-form').addEventListener('submit', async (event) => {
event.preventDefault();
await handleLogin(event.target);
document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault();
await handleLogin(e.target);
});
async function handleLogin(form) {