-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: doing login page and cookies management
- Loading branch information
1 parent
ef2373e
commit 0fe4a99
Showing
13 changed files
with
340 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using MindCare.Application.Entities; | ||
using MindCare.Application.Services.IServices; | ||
|
||
namespace MindCare_Central_Clinic.Controllers | ||
{ | ||
public class LoginController : Controller | ||
{ | ||
private readonly ILogger<HomeController> _logger; | ||
private readonly IUserService _userService; | ||
|
||
public LoginController(ILogger<HomeController> logger, IUserService userService) | ||
{ | ||
_logger = logger; | ||
_userService = userService; | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
public JsonResult Get(User user) | ||
{ | ||
User login = new(); | ||
string message = "Login efetuado!"; | ||
try | ||
{ | ||
login = _userService.GetUser(user).Result; | ||
if (login.Id == 0) | ||
{ | ||
message = "Credenciais inválidas! Tente novamente ou entre em contato com o suporte."; | ||
throw new Exception(message); | ||
} | ||
|
||
|
||
} | ||
catch (Exception e) | ||
{ | ||
message = e.Message; | ||
} | ||
return Json(new { message, login }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
| ||
@{ | ||
ViewData["Title"] = "Login"; | ||
} | ||
@section NoMenu { } | ||
|
||
<div> | ||
@await Html.PartialAsync("~/Views/Login/Partials/_LoginSection.cshtml"); | ||
|
||
<div id="index-warning-login"></div> | ||
</div> | ||
|
||
<script src="~/js/login.js"></script> |
20 changes: 20 additions & 0 deletions
20
MindCare-Central-Clinic/Views/Login/Partials/_LoginSection.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div> | ||
<h2>Tela de Login</h2> | ||
<div> | ||
<div> | ||
<span>Login</span> | ||
<input id="login-username" type="text"> | ||
</div> | ||
<div> | ||
<span>Senha</span> | ||
<input id="login-password" type="password"> | ||
</div> | ||
<div> | ||
<input type="checkbox" onclick=""> | ||
<span>Mostrar Senha</span> | ||
</div> | ||
<div> | ||
<button onclick="ActLogin.Get()">Login</button> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans'); | ||
|
||
:root { | ||
--blue: #0e0620; | ||
--white: #fff; | ||
--green: #2ccf6d; | ||
} | ||
|
||
html, | ||
body { | ||
height: 100%; | ||
} | ||
|
||
body { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-family: "Nunito Sans"; | ||
color: var(--blue); | ||
font-size: 1em; | ||
} | ||
|
||
button { | ||
font-family: "Nunito Sans"; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding-inline-start: 35px; | ||
} | ||
|
||
svg { | ||
width: 100%; | ||
visibility: hidden; | ||
} | ||
|
||
h1 { | ||
font-size: 7.5em; | ||
margin: 15px 0px; | ||
font-weight: bold; | ||
} | ||
|
||
h2 { | ||
font-weight: bold; | ||
} | ||
|
||
.hamburger-menu { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
padding: 35px; | ||
z-index: 2; | ||
& button | ||
|
||
{ | ||
position: relative; | ||
width: 30px; | ||
height: 22px; | ||
border: none; | ||
background: none; | ||
padding: 0; | ||
cursor: pointer; | ||
& span | ||
|
||
{ | ||
position: absolute; | ||
height: 3px; | ||
background: #000; | ||
width: 100%; | ||
left: 0px; | ||
top: 0px; | ||
transition: 0.1s ease-in; | ||
&:nth-child(2) | ||
|
||
{ | ||
top: 9px; | ||
} | ||
|
||
&:nth-child(3) { | ||
top: 18px; | ||
} | ||
|
||
} | ||
} | ||
|
||
& [data-state="open"] { | ||
& span | ||
|
||
{ | ||
&:first-child | ||
|
||
{ | ||
transform: rotate(45deg); | ||
top: 10px; | ||
} | ||
|
||
&:nth-child(2) { | ||
width: 0%; | ||
opacity: 0; | ||
} | ||
|
||
&:nth-child(3) { | ||
transform: rotate(-45deg); | ||
top: 10px; | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
nav { | ||
position: absolute; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
background: var(--green); | ||
color: var(--blue); | ||
width: 300px; | ||
z-index: 1; | ||
padding-top: 80px; | ||
transform: translateX(-100%); | ||
transition: 0.24s cubic-bezier(.52,.01,.8,1); | ||
& li | ||
|
||
{ | ||
transform: translateX(-5px); | ||
transition: 0.16s cubic-bezier(0.44, 0.09, 0.46, 0.84); | ||
opacity: 0; | ||
} | ||
|
||
& a { | ||
display: block; | ||
font-size: 1.75em; | ||
font-weight: bold; | ||
text-decoration: none; | ||
color: inherit; | ||
transition: 0.24s ease-in-out; | ||
&:hover | ||
|
||
{ | ||
text-decoration: none; | ||
color: var(--white); | ||
} | ||
|
||
} | ||
|
||
&[data-state="open"] { | ||
transform: translateX(0%); | ||
& ul | ||
|
||
{ | ||
@for $i from 1 through 4 { | ||
li:nth-child(#{$i}) { | ||
transition-delay: 0.16s * $i; | ||
transform: translateX(0px); | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
.btn { | ||
z-index: 1; | ||
overflow: hidden; | ||
background: transparent; | ||
position: relative; | ||
padding: 8px 50px; | ||
border-radius: 30px; | ||
cursor: pointer; | ||
font-size: 1em; | ||
letter-spacing: 2px; | ||
transition: 0.2s ease; | ||
font-weight: bold; | ||
margin: 5px 0px; | ||
&.green | ||
|
||
{ | ||
border: 4px solid var(--green); | ||
color: var(--blue); | ||
&:before | ||
|
||
{ | ||
content: ""; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
width: 0%; | ||
height: 100%; | ||
background: var(--green); | ||
z-index: -1; | ||
transition: 0.2s ease; | ||
} | ||
|
||
&:hover { | ||
color: var(--white); | ||
background: var(--green); | ||
transition: 0.2s ease; | ||
&:before | ||
|
||
{ | ||
width: 100%; | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
@media screen and (max-width:768px) { | ||
body { | ||
display: block; | ||
} | ||
|
||
.container { | ||
margin-top: 70px; | ||
margin-bottom: 70px; | ||
} | ||
} |
Oops, something went wrong.