This commit is contained in:
shadowik 2023-05-19 20:37:30 +04:00
parent 477f751d75
commit 5b12ab8f22
6 changed files with 180 additions and 78 deletions

View File

@ -87,11 +87,35 @@ namespace BankYouBankruptCashierApp.Controllers
Response.Redirect("Index");
}
#endregion
[HttpGet]
public IActionResult Login()
{
return View();
}
#region Вывод ошибок
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[HttpPost]
public void Login(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APICashier.Cashier = APICashier.GetRequest<CashierViewModel>($"api/Cashier/Login?login={login}&password={password}");
if (APICashier.Cashier == null)
{
throw new Exception("Неверный логин/пароль");
}
Response.Redirect("Enter");
}
#endregion
#region Вывод ошибок
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel

View File

@ -1,27 +1,21 @@
@{
ViewData["Title"] = "Авторизация";
ViewData["Title"] = "Страница пользователя";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
<h1 class="display-4">Страница пользователя</h1>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8">
<input type="text" name="login" />
</div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8">
<input type="password" name="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>
<div class="text-center">
@{
<img src="~/lib/logo.png" style="width: 50%"/>
if (APICashier.Cashier == null)
{
<h3 class="display-4">Сначала авторизируйтесь</h3>
return;
}
<p>Здравствуйтe, @APICashier.Cashier.Name @APICashier.Cashier.Patronymic</p>
}
</div>

View File

@ -0,0 +1,27 @@
@{
ViewData["Title"] = "Авторизация";
}
<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" />
</div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8">
<input type="password" name="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>

View File

@ -16,58 +16,49 @@
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body class="MyBody">
<header>
<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-controller="Home" aspaction="Index">
Банк "Вы банкрот"
</a>
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
<ul class="navbar-nav flex-grow-1">
@{
if (authenticated)
{
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Счета</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Debiting">Заявки на снятие</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Crediting">Заявки на начисление</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="MoneyTransfers">Переводы</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportWithAccounts">Отчёт по аккаунтам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreateReport">Отчёт</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Diagram">Диаграмма</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личный кабинет</a>
</li>
}
}
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
<header class="d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 px-4 mg-5 mb-4 border-bottom bg-dark ">
<div class="col-md-3 mb-2 mb-md-0">
<a asp-controller="Home" asp-action="Enter" class="d-inline-flex link-body-emphasis text-decoration-none">
<span class="fs-4 text-light ">Банк "Вы банкрот"</span>
</a>
</div>
<ul class="nav col-12 col-md-auto mb-2 justify-content-center mb-md-0 nav-main">
<li>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Счета</a>
</li>
<li class="dropdown">
<a href="#" class="nav-link px-2 link-light">Операции</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
<li><a class="dropdown-item" asp-controller="Home" asp-action="Debiting">Заявки на снятие</a></li>
<li><a class="dropdown-item" asp-controller="Home" asp-action="Crediting">Заявки на начисление</a></li>
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="Crediting">Заявки на начисление</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="nav-link px-2 link-light">Отчеты</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="ReportWithAccounts">Отчёт по аккаунтам</a></li>
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="CreateReport">Отчёт</a></li>
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="Diagram">Диаграмма</a></li>
</ul>
</li>
</ul>
@{
if (APICashier.Cashier == null)
{
<div class="col-md-3 text-end">
<a class="btn btn-warning me-2" asp-controller="Home" asp-action="Login">Войти</a>
<a class="btn btn-warning" asp-controller="Home" asp-action="Register">Регистрация</a>
</div>
</div>
</nav>
}
else
{
<div class="col-md-3 text-end">
<a class="btn btn-warning me-2" id="exit" name="exit" asp-controller="Home" asp-action="Privacy">Личный кабинет</a>
</div>
}
}
</header>
<div class="container">
<main role="main" class="pb-3">

View File

@ -17,6 +17,72 @@ body {
margin-bottom: 60px;
}
.MyBody{
.nav-main a {
position: relative;
color: #FFFFFF;
cursor: pointer;
line-height: 1;
text-decoration: none;
}
.nav-main a:after {
display: block;
position: absolute;
left: 0;
bottom: 0px;
width: 0;
height: 1px;
background-color: #FFFFFF;
content: "";
transition: width 0.3s ease-out;
}
.nav-main a:hover:after,
.nav-main a:focus:after {
width: 100%;
}
.nav-main .dropdown:hover .dropdown-menu {
display: block;
margin-top: 0;
}
.footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 80px;
}
.form-signin {
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
}
.form-signin .form-control {
position: relative;
box-sizing: border-box;
height: auto;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB