Template
mirror of
https://github.com/egmont11/ASP.Net-Core-MVC-Template.git
synced 2026-07-24 07:09:56 +02:00
Added some GDPR things (data export, deletion, edit)
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
@model ProfileViewModel
|
||||
@{
|
||||
ViewData["Title"] = "My Profile";
|
||||
}
|
||||
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-md-6">
|
||||
@if (TempData["SuccessMessage"] != null)
|
||||
{
|
||||
<div class="alert alert-success">@TempData["SuccessMessage"]</div>
|
||||
}
|
||||
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-body p-4">
|
||||
<h1 class="card-title text-center mb-4">My Profile</h1>
|
||||
|
||||
<form asp-action="Profile">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="UserName" class="form-label"></label>
|
||||
<input asp-for="UserName" class="form-control" />
|
||||
<span asp-validation-for="UserName" class="text-danger small"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Email" class="form-label"></label>
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger small"></span>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<p class="text-muted small">Change Password (optional)</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="NewPassword" class="form-label"></label>
|
||||
<input asp-for="NewPassword" class="form-control" />
|
||||
<span asp-validation-for="NewPassword" class="text-danger small"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="ConfirmPassword" class="form-label"></label>
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger small"></span>
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-4">
|
||||
<button type="submit" class="btn btn-primary">Update Profile</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-danger shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<h3 class="text-danger">Privacy & Data</h3>
|
||||
<p class="text-muted small">Manage your personal data and account status.</p>
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
<a asp-action="DownloadData" class="btn btn-outline-info">Download My Data (JSON)</a>
|
||||
|
||||
<form asp-action="DeleteAccount" method="post" onsubmit="return confirm('Are you absolutely sure you want to delete your account? This action cannot be undone.');">
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-outline-danger">Delete My Account</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
||||
@@ -30,28 +30,33 @@
|
||||
<ul class="navbar-nav">
|
||||
@if (User.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
@if (User.IsInRole("Admin"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-primary fw-bold" asp-area="Admin" asp-controller="Dashboard" asp-action="Index">Admin Panel</a>
|
||||
</li>
|
||||
}
|
||||
<li class="nav-item">
|
||||
<span class="nav-link text-dark">Hello, @User.Identity.Name!</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form asp-controller="Auth" asp-action="Logout" method="post" class="form-inline">
|
||||
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
|
||||
</form>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle text-dark" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<strong>@User.Identity.Name</strong>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
|
||||
@if (User.IsInRole("Admin"))
|
||||
{
|
||||
<li><a class="dropdown-item text-primary fw-bold" asp-area="Admin" asp-controller="Dashboard" asp-action="Index">Admin Panel</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
}
|
||||
<li><a class="dropdown-item" asp-area="" asp-controller="Auth" asp-action="Profile">My Profile</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li>
|
||||
<form asp-area="" asp-controller="Auth" asp-action="Logout" method="post" class="dropdown-item p-0">
|
||||
<button type="submit" class="btn btn-link dropdown-item">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Auth" asp-action="Register">Register</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Auth" asp-action="Register">Register</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Auth" asp-action="Login">Login</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Auth" asp-action="Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user