This commit is contained in:
2025-09-12 11:50:04 +02:00
parent 6e6d17b134
commit 7def038cc9
21 changed files with 285 additions and 216 deletions

View File

@@ -89,6 +89,29 @@
</tbody>
</table>
<div class="card shadow mt-5 p-4" style="width: 100%; margin: auto;">
<h4><i class="bi bi-pencil-square me-2"></i>Benutzerdaten ändern</h4>
<form asp-action="Edit" method="post" asp-controller="User">
<div class="mb-3">
<label for="Username" class="form-label">Neuer Benutzername</label>
<input type="text" class="form-control" id="Username" name="Username" value="@preferredUsername" />
</div>
<div class="mb-3">
<label for="NewPassword" class="form-label">Neues Passwort</label>
<input type="password" class="form-control" id="NewPassword" name="NewPassword" />
</div>
<div class="mb-3">
<label for="ConfirmPassword" class="form-label">Passwort bestätigen</label>
<input type="password" class="form-control" id="ConfirmPassword" name="ConfirmPassword" />
</div>
<button type="submit" class="btn btn-db">
<i class="bi bi-save me-1"></i>Speichern
</button>
</form>
</div>
<div>
<form method="post" asp-controller="Auth" asp-action="Logout" class="text-center mt-4">
<button type="submit" class="btn btn-danger">

View File

@@ -1,144 +0,0 @@
@{
ViewData["Title"] = "Settings";
var pictureUrl = User.Claims.FirstOrDefault(c => c.Type == "picture")?.Value ?? "";
var preferredUsername = User.Claims.FirstOrDefault(c => c.Type == "preferred_username")?.Value ?? "admin";
var isLocalUser = ViewBag.IdentityProvider == "local";
var DbEngine = ViewBag.DbProvider;
var mail = ViewBag.mail;
}
<head>
<link rel="stylesheet" href="~/css/site.css" />
<link rel="stylesheet" href="~/css/user-settings.css" />
</head>
<div class="Settingscontainer">
@if (isLocalUser)
{
<div class="card shadow mt-5 p-4" style="width: 40%; margin: auto;">
<h4><i class="bi bi-pencil-square me-2"></i>Benutzerdaten ändern</h4>
<form asp-action="Edit" method="post" asp-controller="User">
<div class="mb-3">
<label for="Username" class="form-label">Neuer Benutzername</label>
<input type="text" class="form-control" id="Username" name="Username" value="@preferredUsername" />
</div>
<div class="mb-3">
<label for="NewPassword" class="form-label">Neues Passwort</label>
<input type="password" class="form-control" id="NewPassword" name="NewPassword" />
</div>
<div class="mb-3">
<label for="ConfirmPassword" class="form-label">Passwort bestätigen</label>
<input type="password" class="form-control" id="ConfirmPassword" name="ConfirmPassword" />
</div>
<button type="submit" class="btn btn-db">
<i class="bi bi-save me-1"></i>Speichern
</button>
</form>
</div>
}
else
{
<div class="alert alert-info mt-4 text-center" style="width: 40%; margin: auto;">
<i class="bi bi-info-circle me-1"></i>Benutzerdaten können nur für lokal angemeldete Nutzer geändert werden.
</div>
}
<div class="card shadow mt-5 p-4" style="width: 55%; margin: auto;">
<h4><i class="bi bi-pencil-square me-2"></i>Systemeinformationen</h4>
<br>
<h5>Watcher Version: v0.1.0</h5>
<hr class="my-4" />
<h5>Authentifizierungsmethode: <strong>@(ViewBag.IdentityProvider ?? "nicht gefunden")</strong></h5>
<hr class="my-4" />
<h5>Datenbank-Engine: <strong>@(DbEngine ?? "nicht gefunden")</strong></h5>
<!-- Falls Sqlite verwendet wird können Backups erstellt werden -->
@if (DbEngine == "Microsoft.EntityFrameworkCore.Sqlite")
{
<div class="d-flex gap-2">
<form asp-action="CreateSqlDump" method="post" asp-controller="Database">
<button type="submit" class="btn btn-db">
<i class="bi bi-save me-1"></i> Backup erstellen
</button>
</form>
<form asp-action="ManageSqlDumps" method="post" asp-controller="Database">
<button type="submit" class="btn btn-db">
<i class="bi bi-save me-1"></i> Backups verwalten
</button>
</form>
</div>
}
else if (DbEngine == "Microsoft.EntityFrameworkCore.MySQL")
{
<p> MySQL Dump aktuell nicht möglich </p>
}
<!-- Status für Erstellung eines Backups -->
@if (TempData["DumpMessage"] != null)
{
<div class="alert alert-success">
<i class="bi bi-check-circle me-1"></i>@TempData["DumpMessage"]
</div>
}
@if (TempData["DumpError"] != null)
{
<div class="alert alert-danger">
<i class="bi bi-exclamation-circle me-1"></i>@TempData["DumpError"]
</div>
}
</div>
<div class="card shadow mt-5 p-4" style="width: 55%; margin: auto;">
<h4><i class="bi bi-pencil-square me-2"></i>Benachrichtungen</h4>
<p>Registrierte E-Mail Adresse: <strong>@(ViewBag.mail ?? "nicht gefunden")</strong></p>
<!-- action="/Notification/UpdateSettings" existiert noch nicht-->
<form method="post" action="#">
<div class="card p-4 shadow-sm" style="max-width: 500px;">
<h5 class="card-title mb-3">
<i class="bi bi-bell me-2"></i>Benachrichtigungseinstellungen
</h5>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="notifyOffline" name="NotifyOffline" checked>
<label class="form-check-label" for="notifyOffline">Benachrichtigung bei Server-Offline</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="notifyUpdates" name="NotifyUpdates">
<label class="form-check-label" for="notifyUpdates">Benachrichtigung bei neuen Updates</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="notifyUser" name="NotifyUser">
<label class="form-check-label" for="notifyUser">Benachrichtigung bei neuen Benutzern</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="notifyMaintenance" name="NotifyMaintenance">
<label class="form-check-label" for="notifyMaintenance">Wartungsinformationen erhalten</label>
</div>
<button type="submit" class="btn btn-db mt-3">
<i class="bi bi-save me-1"></i>Speichern
</button>
</div>
</form>
<hr class="my-4" />
</div>
</div>