Working on wiring up identity and basket
This commit is contained in:
62
src/Web/Views/Account/Signin.cshtml
Normal file
62
src/Web/Views/Account/Signin.cshtml
Normal file
@@ -0,0 +1,62 @@
|
||||
@using System.Collections.Generic
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Authentication
|
||||
@model LoginViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Log in";
|
||||
}
|
||||
<div class="brand-header-block">
|
||||
<ul class="container">
|
||||
<li><a asp-area="" asp-controller="Account" asp-action="Register">REGISTER</a></li>
|
||||
<li class="active" style="margin-right: 65px;">LOGIN</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container account-login-container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<section>
|
||||
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<h4>ARE YOU REGISTERED?</h4>
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="control-label form-label"></label>
|
||||
<input asp-for="Email" class="form-control form-input form-input-center" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="control-label form-label"></label>
|
||||
<input asp-for="Password" class="form-control form-input form-input-center" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label asp-for="RememberMe">
|
||||
<input asp-for="RememberMe" />
|
||||
@Html.DisplayNameFor(m => m.RememberMe)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-default btn-brand btn-brand-big"> LOG IN </button>
|
||||
</div>
|
||||
<p>
|
||||
<a asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" class="text">Register as a new user?</a>
|
||||
</p>
|
||||
<p>
|
||||
Note that for demo purposes you don't need to register and can login with these credentials:
|
||||
</p>
|
||||
<p>
|
||||
User: <b>demouser@microsoft.com</b>
|
||||
</p>
|
||||
<p>
|
||||
Password: <b>Pass@word1</b>
|
||||
</p>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
||||
@@ -29,7 +29,8 @@
|
||||
<img src="../images/brand.png" />
|
||||
</a>
|
||||
</section>
|
||||
|
||||
@await Html.PartialAsync("_LoginPartial")
|
||||
|
||||
</article>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
57
src/Web/Views/Shared/_LoginPartial.cshtml
Normal file
57
src/Web/Views/Shared/_LoginPartial.cshtml
Normal file
@@ -0,0 +1,57 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@*@inject IIdentityParser<ApplicationUser> UserManager*@
|
||||
|
||||
@if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
<section class="col-lg-4 col-md-5 col-xs-12">
|
||||
<div class="esh-identity">
|
||||
<form asp-area="" asp-controller="Account" asp-action="SignOut" method="post" id="logoutForm" class="navbar-right">
|
||||
<section class="esh-identity-section">
|
||||
|
||||
@*<div class="esh-identity-name">@User.FindFirst(x => x.Type == "preferred_username").Value</div>*@
|
||||
<img class="esh-identity-image" src="~/images/arrow-down.png">
|
||||
</section>
|
||||
|
||||
<section class="esh-identity-drop">
|
||||
|
||||
<a class="esh-identity-item"
|
||||
asp-controller="Order"
|
||||
asp-action="Index">
|
||||
|
||||
<div class="esh-identity-name esh-identity-name--upper">My orders</div>
|
||||
<img class="esh-identity-image" src="~/images/my_orders.png">
|
||||
</a>
|
||||
|
||||
<a class="esh-identity-item"
|
||||
href="javascript:document.getElementById('logoutForm').submit()">
|
||||
|
||||
<div class="esh-identity-name esh-identity-name--upper">Log Out</div>
|
||||
<img class="esh-identity-image" src="~/images/logout.png">
|
||||
</a>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="col-lg-1 col-xs-12">
|
||||
@*@await Component.InvokeAsync("Cart", new { user = UserManager.Parse(User) })*@
|
||||
</section>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<section class="col-lg-4 col-md-5 col-xs-12">
|
||||
<div class="esh-identity">
|
||||
<section class="esh-identity-section">
|
||||
<div class="esh-identity-item">
|
||||
|
||||
<a asp-area="" asp-controller="Account" asp-action="SignIn" class="esh-identity-name esh-identity-name--upper">
|
||||
Login
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="col-lg-1 col-xs-12"></section>
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
@using Microsoft.eShopWeb
|
||||
@using Microsoft.eShopWeb.ViewModels
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
Reference in New Issue
Block a user