Merge branch 'main' of https://git.is.ulstu.ru/DavidMakarov/PIbd-21_Makarov_Razubaev_CourseWork
This commit is contained in:
commit
4b5d089fe1
@ -72,7 +72,6 @@ namespace FactoryDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
Email = model.Email;
|
||||
Password = model.Password;
|
||||
}
|
||||
|
@ -101,6 +101,53 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(Client.client);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Privacy(string email, string password)
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
var existsClient = clientLogic.ReadElement(new ClientSearchModel
|
||||
{
|
||||
Id = Client.client.Id,
|
||||
});
|
||||
clientLogic.Update(new ClientBindingModel
|
||||
{
|
||||
Id = Client.client.Id,
|
||||
Login = existsClient.Login,
|
||||
Password = password,
|
||||
Email = email,
|
||||
});
|
||||
var updatedClient = clientLogic.ReadElement(new ClientSearchModel
|
||||
{
|
||||
Id = Client.client.Id,
|
||||
});
|
||||
Client.client = updatedClient;
|
||||
return Redirect("~/Home/Index");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Logout()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
Client.client = null;
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Machines()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
|
29
Factory/FactoryStorekeeperApp/Views/Home/Privacy.cshtml
Normal file
29
Factory/FactoryStorekeeperApp/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,29 @@
|
||||
@using FactoryContracts.ViewModels
|
||||
@{
|
||||
ViewData["Title"] = "Профиль";
|
||||
}
|
||||
@model ClientViewModel
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Профиль кладовщика</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8"><input type="text" name="login" id="login" value="@Model.Login" readonly disabled/></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Почта:</div>
|
||||
<div class="col-8"><input type="email" id="email" name="email" value="@Model.Email" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Новый пароль:</div>
|
||||
<div class="col-8"><input type="password" name="password" id="password" value="@Model.Password" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
<form asp-controller="Home" asp-action="Logout" method="post">
|
||||
<button type="submit" class="btn btn-danger">Выйти из аккаунта</button>
|
||||
</form>
|
@ -13,21 +13,30 @@
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-page="/Index">Завод "Иди работать". Кладовщик</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</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">Главная</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
</li>
|
||||
@if (Client.client != null){
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="Privacy">Профиль</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user