feat: registration system, login system template
This commit is contained in:
parent
cbba5c7372
commit
c27727db32
32
TicketOffice/Pages/Auth/Login.cshtml
Normal file
32
TicketOffice/Pages/Auth/Login.cshtml
Normal file
@ -0,0 +1,32 @@
|
||||
@page
|
||||
@model TicketOffice.Pages.Auth.LoginModel
|
||||
|
||||
@{
|
||||
Layout = "~/Pages/Shared/_Layout.cshtml";
|
||||
ViewData["Title"] = "Авторизація";
|
||||
}
|
||||
|
||||
<link rel="stylesheet" href="~/css/Auth.css" asp-append-version="true"/>
|
||||
|
||||
<div class="wrapper">
|
||||
<form class="auth-form" method="post">
|
||||
<div class="header">
|
||||
Авторизація
|
||||
</div>
|
||||
|
||||
<input class="field" placeholder="E-mail" autocomplete="off" asp-for="User.Email"/>
|
||||
<span asp-validation-for="User.Email" class="validation-error"></span>
|
||||
<br>
|
||||
|
||||
<input class="field" placeholder="Пароль" autocomplete="off" asp-for="User.Password"/>
|
||||
<span asp-validation-for="User.Password" class="validation-error"></span>
|
||||
<br>
|
||||
|
||||
<input class="submit-btn" type="submit" value="Авторизуватись"/>
|
||||
|
||||
<div class="hint">
|
||||
Не маєте аккаунта?
|
||||
<a href="/auth/registration" class="link">Зареєструватись</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
30
TicketOffice/Pages/Auth/Login.cshtml.cs
Normal file
30
TicketOffice/Pages/Auth/Login.cshtml.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using TicketOffice.Data;
|
||||
using TicketOffice.Models;
|
||||
|
||||
namespace TicketOffice.Pages.Auth;
|
||||
|
||||
public class LoginModel : PageModel
|
||||
{
|
||||
private readonly TicketOfficeContext _context;
|
||||
|
||||
public LoginModel(TicketOfficeContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
[BindProperty]
|
||||
public User User { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
{
|
||||
//Login logic
|
||||
return Page();
|
||||
}
|
||||
}
|
32
TicketOffice/Pages/Auth/Registration.cshtml
Normal file
32
TicketOffice/Pages/Auth/Registration.cshtml
Normal file
@ -0,0 +1,32 @@
|
||||
@page
|
||||
@model TicketOffice.Pages.Auth.RegistrationModel
|
||||
|
||||
@{
|
||||
Layout = "~/Pages/Shared/_Layout.cshtml";
|
||||
ViewData["Title"] = "Реєстрація";
|
||||
}
|
||||
|
||||
<link rel="stylesheet" href="~/css/Auth.css" asp-append-version="true"/>
|
||||
|
||||
<div class="wrapper">
|
||||
<form class="auth-form" method="post">
|
||||
<div class="header">
|
||||
Реєстрація
|
||||
</div>
|
||||
|
||||
<input class="field" placeholder="E-mail" autocomplete="off" asp-for="User.Email"/>
|
||||
<span asp-validation-for="User.Email" class="validation-error"></span>
|
||||
<br>
|
||||
|
||||
<input class="field" placeholder="Пароль" autocomplete="off" asp-for="User.Password"/>
|
||||
<span asp-validation-for="User.Password" class="validation-error"></span>
|
||||
<br>
|
||||
|
||||
<input class="submit-btn" type="submit" value="Зареєструватись"/>
|
||||
|
||||
<div class="hint">
|
||||
Вже маєте аккаунт?
|
||||
<a href="/auth/login" class="link">Авторизуватись</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
37
TicketOffice/Pages/Auth/Registration.cshtml.cs
Normal file
37
TicketOffice/Pages/Auth/Registration.cshtml.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using TicketOffice.Data;
|
||||
using TicketOffice.Models;
|
||||
|
||||
namespace TicketOffice.Pages.Auth;
|
||||
|
||||
public class RegistrationModel : PageModel
|
||||
{
|
||||
private readonly TicketOfficeContext _context;
|
||||
|
||||
public RegistrationModel(TicketOfficeContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
[BindProperty]
|
||||
public User User { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
_context.User.Add(User);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToPage("./");
|
||||
}
|
||||
}
|
@ -4,11 +4,3 @@
|
||||
ViewData["Title"] = "Home page";
|
||||
}
|
||||
|
||||
<div class="topnav">
|
||||
<a class="active" href="/">Головна</a>
|
||||
<a href="/routes">Пошук маршрутів</a>
|
||||
<div class="topnav-right">
|
||||
<a href="/auth/login">Авторизація</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,14 +1,37 @@
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using TicketOffice.Data;
|
||||
using TicketOffice.Models;
|
||||
|
||||
namespace TicketOffice.Pages;
|
||||
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
public IndexModel()
|
||||
private readonly TicketOfficeContext _context;
|
||||
|
||||
public IndexModel(TicketOfficeContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
[BindProperty]
|
||||
public User User { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
_context.User.Add(User);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToPage("./Routes");
|
||||
}
|
||||
}
|
@ -11,14 +11,6 @@
|
||||
|
||||
<link rel="stylesheet" href="~/css/Routes.css" asp-append-version="true"/>
|
||||
|
||||
<div class="topnav">
|
||||
<a href="/">Головна</a>
|
||||
<a class="active" href="/routes">Пошук маршрутів</a>
|
||||
<div class="topnav-right">
|
||||
<a href="/auth/login">Авторизація</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
|
||||
<form class="search-block">
|
||||
|
@ -14,6 +14,17 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="topnav">
|
||||
@{
|
||||
string path = @Model.Request.Path.ToString();
|
||||
}
|
||||
|
||||
<a class="@(path == "/" ? "active" : "")" href="/">Головна</a>
|
||||
<a class="@(path.Contains("routes") ? "active" : "")" href="/routes">Пошук маршрутів</a>
|
||||
<div class="topnav-right">
|
||||
<a class="@(path.Contains("auth") ? "active" : "")" href="/auth/login">Авторизація</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@RenderBody()
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using TicketOffice.Data;
|
||||
using TicketOffice.Models;
|
||||
|
||||
@ -25,12 +24,11 @@ if (!app.Environment.IsDevelopment())
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
app.UseRouting();
|
||||
|
||||
app.MapRazorPages();
|
||||
|
||||
|
@ -30,4 +30,9 @@
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Pages\Auth\Registration\Index.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Pages\Auth\Login\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
80
TicketOffice/wwwroot/css/Auth.css
Normal file
80
TicketOffice/wwwroot/css/Auth.css
Normal file
@ -0,0 +1,80 @@
|
||||
html {
|
||||
font-size: 16px;
|
||||
min-height: 100%;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 700;
|
||||
background-color: #eaeef1;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 50rem;
|
||||
margin: 1.5rem auto;
|
||||
padding: 3rem 0;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 1px 2.4rem 0 #c3c9d0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 1.5rem;
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
input.field {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: #262626;
|
||||
line-height: 4.7rem;
|
||||
width: 30rem;
|
||||
height: 3rem;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
border: 0.1rem solid #b8bfc7;
|
||||
box-shadow: 0 1px 0 0 #fff;
|
||||
border-radius: .3rem;
|
||||
padding: 0 1.1rem;
|
||||
margin-bottom: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
input.field:focus {
|
||||
outline: 0;
|
||||
border-color: #68b2dd;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
input.submit-btn {
|
||||
color: #1d4965;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 700;
|
||||
line-height: 3rem;
|
||||
padding: 0 1.5rem;
|
||||
background: linear-gradient(0deg,#79b6db,#b3dbf2);
|
||||
border: none;
|
||||
border-radius: .3rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin-top: 1.5rem;
|
||||
color: #777a7e;
|
||||
}
|
||||
|
||||
input[type=submit]:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: #245c78;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user