A few changes with this checkin
1. Adding cookies middleware to the music store app 2. Enabling login, register & related management pages to render some UI for testing 3. Updated the LKG.json
This commit is contained in:
parent
b37c811266
commit
9127f5b930
|
|
@ -65,6 +65,7 @@ namespace MusicStore.Controllers
|
|||
//
|
||||
// GET: /Account/Register
|
||||
[AllowAnonymous]
|
||||
[HttpGet] //TODO: Do we need this. Without this I seem to be landing here irrespective of the HTTP verb?
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
|
|
@ -362,7 +363,7 @@ namespace MusicStore.Controllers
|
|||
|
||||
private async Task SignIn(ApplicationUser user, bool isPersistent)
|
||||
{
|
||||
this.Context.Response.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
//this.Context.Response.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
|
||||
this.Context.Response.SignIn(identity, new AuthenticationProperties() { IsPersistent = isPersistent });
|
||||
}
|
||||
|
|
@ -447,7 +448,7 @@ namespace MusicStore.Controllers
|
|||
{
|
||||
public static string GetUserId(this IIdentity user)
|
||||
{
|
||||
return string.Empty;
|
||||
return user.Name;
|
||||
}
|
||||
|
||||
public static Task<ExternalLoginInfo> GetExternalLoginInfo(this HttpResponse response)
|
||||
|
|
|
|||
|
|
@ -1,33 +1,36 @@
|
|||
{
|
||||
"version": "0.1-alpha-*",
|
||||
"dependencies": {
|
||||
"Helios": "0.1-alpha-243",
|
||||
"Microsoft.AspNet.Abstractions": "0.1-alpha-239",
|
||||
"Microsoft.AspNet.Mvc": "0.1-alpha-573",
|
||||
"Helios": "0.1-alpha-254",
|
||||
"Microsoft.AspNet.Abstractions": "0.1-alpha-249",
|
||||
"Microsoft.AspNet.Mvc": "0.1-alpha-599",
|
||||
"Microsoft.AspNet.Razor": "0.1-alpha-181",
|
||||
"Microsoft.AspNet.ConfigurationModel": "0.1-alpha-174",
|
||||
"Microsoft.AspNet.DependencyInjection": "0.1-alpha-243",
|
||||
"Microsoft.AspNet.RequestContainer": "0.1-alpha-243",
|
||||
"Microsoft.AspNet.Routing": "0.1-alpha-220",
|
||||
"Microsoft.AspNet.Mvc.ModelBinding": "0.1-alpha-573",
|
||||
"Microsoft.AspNet.Mvc.Core": "0.1-alpha-573",
|
||||
"Microsoft.AspNet.Mvc.Razor": "0.1-alpha-573",
|
||||
"Microsoft.AspNet.StaticFiles": "0.1-alpha-180",
|
||||
"System.Security.Claims": "0.1-alpha-120",
|
||||
"Microsoft.AspNet.DependencyInjection": "0.1-alpha-247",
|
||||
"Microsoft.AspNet.RequestContainer": "0.1-alpha-250",
|
||||
"Microsoft.AspNet.Routing": "0.1-alpha-228",
|
||||
"Microsoft.AspNet.Mvc.ModelBinding": "0.1-alpha-599",
|
||||
"Microsoft.AspNet.Mvc.Core": "0.1-alpha-599",
|
||||
"Microsoft.AspNet.Mvc.Razor": "0.1-alpha-599",
|
||||
"Microsoft.AspNet.StaticFiles": "0.1-alpha-188",
|
||||
"System.Security.Claims": "0.1-alpha-124",
|
||||
"System.Security.Principal": "4.0.0.0",
|
||||
"Microsoft.AspNet.Security.DataProtection": "0.1-alpha-142",
|
||||
"Microsoft.AspNet.Identity": "0.1-alpha-327",
|
||||
"Microsoft.AspNet.Identity.Entity": "0.1-alpha-327",
|
||||
"Microsoft.AspNet.Identity.InMemory": "0.1-alpha-327",
|
||||
"Microsoft.Data.Entity": "0.1-alpha-419",
|
||||
"Microsoft.Data.Relational": "0.1-alpha-419",
|
||||
"Microsoft.AspNet.Identity": "0.1-alpha-347",
|
||||
"Microsoft.AspNet.Identity.Entity": "0.1-alpha-347",
|
||||
"Microsoft.AspNet.Identity.InMemory": "0.1-alpha-347",
|
||||
"Microsoft.Data.Entity": "0.1-alpha-432",
|
||||
"Microsoft.Data.Relational": "0.1-alpha-432",
|
||||
"Microsoft.Data.SqlServer": "0.1-pre-419",
|
||||
"Microsoft.Data.InMemory": "0.1-alpha-419",
|
||||
"Microsoft.Data.Migrations": "0.1-alpha-419",
|
||||
"Microsoft.AspNet.Diagnostics": "0.1-alpha-124",
|
||||
"Microsoft.AspNet.Hosting": "0.1-alpha-243",
|
||||
"Microsoft.AspNet.Server.WebListener": "0.1-alpha-180",
|
||||
"Microsoft.AspNet.Configuration.Json": "0.1-alpha-174"
|
||||
"Microsoft.Data.InMemory": "0.1-alpha-432",
|
||||
"Microsoft.Data.Migrations": "0.1-alpha-432",
|
||||
"Microsoft.AspNet.Diagnostics": "0.1-alpha-133",
|
||||
"Microsoft.AspNet.Hosting": "0.1-alpha-250",
|
||||
"Microsoft.AspNet.Server.WebListener": "0.1-alpha-193",
|
||||
"Microsoft.AspNet.Configuration.Json": "0.1-alpha-174",
|
||||
"Microsoft.AspNet.Security": "0.1-alpha-102",
|
||||
"Microsoft.AspNet.Security.Cookies": "0.1-alpha-102",
|
||||
"Microsoft.AspNet.Logging": "0.1-alpha-159"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.AspNet.Logging;
|
||||
using System;
|
||||
namespace MusicStore.Logging
|
||||
{
|
||||
public class NullLogger : ILogger
|
||||
{
|
||||
public bool WriteCore(TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using Microsoft.AspNet.Logging;
|
||||
namespace MusicStore.Logging
|
||||
{
|
||||
public class NullLoggerFactory : ILoggerFactory
|
||||
{
|
||||
public ILogger Create(string name)
|
||||
{
|
||||
return new NullLogger();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
using Microsoft.AspNet;
|
||||
using Microsoft.AspNet.Abstractions;
|
||||
using Microsoft.AspNet.ConfigurationModel;
|
||||
using Microsoft.AspNet.Configuration.Json;
|
||||
using Microsoft.AspNet.ConfigurationModel;
|
||||
using Microsoft.AspNet.DependencyInjection;
|
||||
using Microsoft.AspNet.DependencyInjection.Fallback;
|
||||
using Microsoft.AspNet.DependencyInjection.NestedProviders;
|
||||
using Microsoft.AspNet.RequestContainer;
|
||||
using Microsoft.AspNet.Diagnostics;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.InMemory;
|
||||
using Microsoft.AspNet.Logging;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.RequestContainer;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.AspNet.Security.Cookies;
|
||||
using Microsoft.Net.Runtime;
|
||||
using MusicStore.Logging;
|
||||
using MusicStore.Models;
|
||||
using MusicStore.Web.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.Net.Runtime;
|
||||
|
||||
public class Startup
|
||||
{
|
||||
|
|
@ -28,14 +28,22 @@ public class Startup
|
|||
//ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
|
||||
app.UseErrorPage(ErrorPageOptions.ShowAll);
|
||||
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddInstance<ILoggerFactory>(new NullLoggerFactory());
|
||||
serviceCollection.Add(MvcServices.GetDefaultServices());
|
||||
app.UseContainer(serviceCollection.BuildServiceProvider(app.ServiceProvider));
|
||||
|
||||
app.UseFileServer();
|
||||
|
||||
var serviceProvider = MvcServices.GetDefaultServices().BuildServiceProvider(app.ServiceProvider);
|
||||
app.UseContainer(serviceProvider);
|
||||
app.UseCookieAuthentication(new CookieAuthenticationOptions()
|
||||
{
|
||||
AuthenticationType = "Application",
|
||||
LoginPath = new PathString("/Account/Login")
|
||||
});
|
||||
|
||||
var routes = new RouteCollection()
|
||||
{
|
||||
DefaultHandler = new MvcApplication(serviceProvider),
|
||||
DefaultHandler = new MvcApplication(app.ServiceProvider),
|
||||
};
|
||||
|
||||
routes.MapRoute(
|
||||
|
|
|
|||
|
|
@ -12,29 +12,32 @@
|
|||
<section id="loginForm">
|
||||
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@*@Html.AntiForgeryToken()*@
|
||||
<h4>Use a local account to log in.</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true)
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">UserName:</label>
|
||||
<div class="col-md-10">
|
||||
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(m => m.UserName)
|
||||
@*@Html.ValidationMessageFor(m => m.UserName)*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Password:</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(m => m.Password)
|
||||
@*@Html.ValidationMessageFor(m => m.Password)*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<div class="checkbox">
|
||||
@Html.CheckBoxFor(m => m.RememberMe)
|
||||
@Html.LabelFor(m => m.RememberMe)
|
||||
@*@Html.LabelFor(m => m.RememberMe)*@
|
||||
<label>Remember Me</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -49,11 +52,12 @@
|
|||
}
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<section id="socialLoginForm">
|
||||
@Html.Partial("_ExternalLoginsListPartial", new { Action = "ExternalLogin", ReturnUrl = ViewBag.ReturnUrl })
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@*<div class="col-md-4">
|
||||
<section id="socialLoginForm">
|
||||
@Html.Partial("_ExternalLoginsListPartial", new { Action = "ExternalLogin", ReturnUrl = ViewBag.ReturnUrl })
|
||||
</section>
|
||||
</div>*@
|
||||
</div>
|
||||
@section Scripts {
|
||||
@*Bug : Script helpers are out of scope for alpha*@
|
||||
|
|
|
|||
|
|
@ -7,23 +7,23 @@
|
|||
}
|
||||
|
||||
<h2>@ViewBag.Title.</h2>
|
||||
|
||||
<p class="text-success">@ViewBag.StatusMessage</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@if (ViewBag.HasLocalPassword)
|
||||
{
|
||||
@Html.Partial("_ChangePasswordPartial")
|
||||
await Html.PartialAsync("_ChangePasswordPartial");
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Partial("_SetPasswordPartial")
|
||||
await Html.PartialAsync("_SetPasswordPartial");
|
||||
}
|
||||
|
||||
<section id="externalLogins">
|
||||
@*<section id="externalLogins">
|
||||
@Html.Action("RemoveAccountList")
|
||||
@Html.Partial("_ExternalLoginsListPartial", new { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl })
|
||||
</section>
|
||||
</section>*@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,26 +9,29 @@
|
|||
|
||||
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@*@Html.AntiForgeryToken()*@
|
||||
<h4>Create a new account.</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary()
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">UserName</label>
|
||||
<div class="col-md-10">
|
||||
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Confirm Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
|
||||
@*@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -1,28 +1,31 @@
|
|||
@using Microsoft.AspNet.Identity
|
||||
@model MusicStore.Models.ManageUserViewModel
|
||||
|
||||
<p>You're logged in as <strong>@User.Identity.GetUserName()</strong>.</p>
|
||||
<p>You're logged in as <strong>@Context.HttpContext.User.Identity.Name</strong>.</p>
|
||||
|
||||
@using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@*@Html.AntiForgeryToken()*@
|
||||
<h4>Change Password Form</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary()
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Old Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">New Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Confirm Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,19 +7,21 @@
|
|||
|
||||
@using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@*@Html.AntiForgeryToken()*@
|
||||
|
||||
<h4>Create Local Login</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary()
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">New Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
|
||||
@*@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })*@
|
||||
<label class="col-md-2 control-label">Confirm Password</label>
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@
|
|||
"Microsoft.AspNet.Diagnostics": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Hosting": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Configuration.Json": "0.1-alpha-*"
|
||||
"Microsoft.AspNet.Configuration.Json": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Security": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Security.Cookies": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Logging": "0.1-alpha-*"
|
||||
},
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001"
|
||||
|
|
|
|||
Loading…
Reference in New Issue