Permalink
Browse files

RC2 Complete

1 parent 55e6873 commit 17ca23f8d26577a23210ebc6b9bd4313e86760e0 @shawnwildermuth committed May 15, 2016
Showing with 500 additions and 297 deletions.
  1. +7 −12 src/RC1toRC2/Controllers/AccountController.cs
  2. +1 −1 src/RC1toRC2/Controllers/HomeController.cs
  3. +6 −6 src/RC1toRC2/Controllers/ManageController.cs
  4. +69 −39 ...ns/{00000000000000_CreateIdentitySchema.Designer.cs → 20160515152410_InitialDatabase.Designer.cs}
  5. +95 −31 src/RC1toRC2/Migrations/{00000000000000_CreateIdentitySchema.cs → 20160515152410_InitialDatabase.cs}
  6. +67 −37 src/RC1toRC2/Migrations/ApplicationDbContextModelSnapshot.cs
  7. +15 −10 src/RC1toRC2/Models/ApplicationDbContext.cs
  8. +5 −5 src/RC1toRC2/Models/ApplicationUser.cs
  9. +6 −4 src/RC1toRC2/Properties/launchSettings.json
  10. +5 −4 src/RC1toRC2/RC1toRC2.xproj
  11. +94 −85 src/RC1toRC2/Startup.cs
  12. +1 −1 src/RC1toRC2/ViewModels/Account/SendCodeViewModel.cs
  13. +1 −1 src/RC1toRC2/ViewModels/Manage/ConfigureTwoFactorViewModel.cs
  14. +1 −1 src/RC1toRC2/ViewModels/Manage/IndexViewModel.cs
  15. +2 −2 src/RC1toRC2/ViewModels/Manage/ManageLoginsViewModel.cs
  16. +1 −1 src/RC1toRC2/Views/Account/ExternalLoginConfirmation.cshtml
  17. +3 −3 src/RC1toRC2/Views/Account/Login.cshtml
  18. +1 −1 src/RC1toRC2/Views/Account/Register.cshtml
  19. +1 −1 src/RC1toRC2/Views/Account/ResetPassword.cshtml
  20. +1 −1 src/RC1toRC2/Views/Account/VerifyCode.cshtml
  21. +1 −1 src/RC1toRC2/Views/Manage/AddPhoneNumber.cshtml
  22. +1 −1 src/RC1toRC2/Views/Manage/ChangePassword.cshtml
  23. +1 −1 src/RC1toRC2/Views/Manage/ManageLogins.cshtml
  24. +1 −1 src/RC1toRC2/Views/Manage/SetPassword.cshtml
  25. +1 −1 src/RC1toRC2/Views/Manage/VerifyPhoneNumber.cshtml
  26. +5 −2 src/RC1toRC2/Views/Shared/_LoginPartial.cshtml
  27. +2 −2 src/RC1toRC2/Views/_ViewImports.cshtml
  28. +1 −1 src/RC1toRC2/appsettings.json
  29. +92 −36 src/RC1toRC2/project.json
  30. +9 −0 src/RC1toRC2/web.config
  31. +4 −4 src/RC1toRC2/wwwroot/_references.js
  32. +0 −1 src/RC1toRC2/wwwroot/css/site.min.css
  33. 0 src/RC1toRC2/wwwroot/js/site.min.js
@@ -3,11 +3,11 @@
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
-using Microsoft.AspNet.Authorization; +using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNet.Identity; +using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNet.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.Data.Entity; +using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using RC1toRC2.Models; using RC1toRC2.Models;
using RC1toRC2.Services; using RC1toRC2.Services;
@@ -181,7 +181,7 @@ public IActionResult ExternalLogin(string provider, string returnUrl = null)
// If the user does not have an account, then ask the user to create an account. // If the user does not have an account, then ask the user to create an account.
ViewData["ReturnUrl"] = returnUrl; ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider; ViewData["LoginProvider"] = info.LoginProvider;
- var email = info.ExternalPrincipal.FindFirstValue(ClaimTypes.Email); + var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email }); return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
} }
} }
@@ -193,11 +193,6 @@ public IActionResult ExternalLogin(string provider, string returnUrl = null)
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null) public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null)
{ {
- if (User.IsSignedIn())
- {
- return RedirectToAction(nameof(ManageController.Index), "Manage");
- }
-
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
// Get the information about the user from the external login provider // Get the information about the user from the external login provider
@@ -447,7 +442,7 @@ private void AddErrors(IdentityResult result)
private async Task<ApplicationUser> GetCurrentUserAsync() private async Task<ApplicationUser> GetCurrentUserAsync()
{ {
- return await _userManager.FindByIdAsync(HttpContext.User.GetUserId()); + return await _userManager.GetUserAsync(HttpContext.User);
} }
private IActionResult RedirectToLocal(string returnUrl) private IActionResult RedirectToLocal(string returnUrl)
@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
-using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc;
namespace RC1toRC2.Controllers namespace RC1toRC2.Controllers
{ {
@@ -3,9 +3,9 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Security.Claims; using System.Security.Claims;
-using Microsoft.AspNet.Authorization; +using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNet.Identity; +using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using RC1toRC2.Models; using RC1toRC2.Models;
using RC1toRC2.Services; using RC1toRC2.Services;
@@ -292,7 +292,7 @@ public IActionResult LinkLogin(string provider)
{ {
// Request a redirect to the external login provider to link a login for the current user // Request a redirect to the external login provider to link a login for the current user
var redirectUrl = Url.Action("LinkLoginCallback", "Manage"); var redirectUrl = Url.Action("LinkLoginCallback", "Manage");
- var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, User.GetUserId()); + var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User));
return new ChallengeResult(provider, properties); return new ChallengeResult(provider, properties);
} }
@@ -306,7 +306,7 @@ public IActionResult LinkLogin(string provider)
{ {
return View("Error"); return View("Error");
} }
- var info = await _signInManager.GetExternalLoginInfoAsync(User.GetUserId()); + var info = await _signInManager.GetExternalLoginInfoAsync(_userManager.GetUserId(User));
if (info == null) if (info == null)
{ {
return RedirectToAction(nameof(ManageLogins), new { Message = ManageMessageId.Error }); return RedirectToAction(nameof(ManageLogins), new { Message = ManageMessageId.Error });
@@ -340,7 +340,7 @@ public enum ManageMessageId
private async Task<ApplicationUser> GetCurrentUserAsync() private async Task<ApplicationUser> GetCurrentUserAsync()
{ {
- return await _userManager.FindByIdAsync(HttpContext.User.GetUserId()); + return await _userManager.GetUserAsync(HttpContext.User);
} }
#endregion #endregion
@@ -1,26 +1,23 @@
-using System; +using System;
-using System.Collections.Generic; +using Microsoft.EntityFrameworkCore;
-using System.Linq; +using Microsoft.EntityFrameworkCore.Infrastructure;
-using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.Data.Entity; +using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.Data.Entity.Infrastructure;
-using Microsoft.Data.Entity.Metadata;
-using Microsoft.Data.Entity.Migrations;
using RC1toRC2.Models; using RC1toRC2.Models;
namespace RC1toRC2.Migrations namespace RC1toRC2.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
- [Migration("00000000000000_CreateIdentitySchema")] + [Migration("20160515152410_InitialDatabase")]
- partial class CreateIdentitySchema + partial class InitialDatabase
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
modelBuilder modelBuilder
- .HasAnnotation("ProductVersion", "7.0.0-beta8") + .HasAnnotation("ProductVersion", "1.0.0-rc2-20901")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id");
@@ -36,12 +33,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
- .HasAnnotation("Relational:Name", "RoleNameIndex"); + .HasName("RoleNameIndex");
- b.HasAnnotation("Relational:TableName", "AspNetRoles"); + b.ToTable("AspNetRoles");
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@@ -50,14 +47,17 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
- b.Property<string>("RoleId"); + b.Property<string>("RoleId")
+ .IsRequired();
b.HasKey("Id"); b.HasKey("Id");
- b.HasAnnotation("Relational:TableName", "AspNetRoleClaims"); + b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@@ -66,37 +66,62 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
- b.Property<string>("UserId"); + b.Property<string>("UserId")
+ .IsRequired();
b.HasKey("Id"); b.HasKey("Id");
- b.HasAnnotation("Relational:TableName", "AspNetUserClaims"); + b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey"); b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName");
- b.Property<string>("UserId"); + b.Property<string>("UserId")
+ .IsRequired();
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
- b.HasAnnotation("Relational:TableName", "AspNetUserLogins"); + b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
b.Property<string>("RoleId"); b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
- b.HasAnnotation("Relational:TableName", "AspNetUserRoles"); + b.HasIndex("RoleId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
+ {
+ b.Property<string>("UserId");
+
+ b.Property<string>("LoginProvider");
+
+ b.Property<string>("Name");
+
+ b.Property<string>("Value");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
}); });
modelBuilder.Entity("RC1toRC2.Models.ApplicationUser", b => modelBuilder.Entity("RC1toRC2.Models.ApplicationUser", b =>
@@ -139,44 +164,49 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
- .HasAnnotation("Relational:Name", "EmailIndex"); + .HasName("EmailIndex");
b.HasIndex("NormalizedUserName") b.HasIndex("NormalizedUserName")
- .HasAnnotation("Relational:Name", "UserNameIndex"); + .HasName("UserNameIndex");
- b.HasAnnotation("Relational:TableName", "AspNetUsers"); + b.ToTable("AspNetUsers");
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{ {
- b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany() .WithMany()
- .HasForeignKey("RoleId"); + .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade);
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{ {
b.HasOne("RC1toRC2.Models.ApplicationUser") b.HasOne("RC1toRC2.Models.ApplicationUser")
.WithMany() .WithMany()
- .HasForeignKey("UserId"); + .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{ {
b.HasOne("RC1toRC2.Models.ApplicationUser") b.HasOne("RC1toRC2.Models.ApplicationUser")
.WithMany() .WithMany()
- .HasForeignKey("UserId"); + .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
}); });
- modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{ {
- b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany() .WithMany()
- .HasForeignKey("RoleId"); + .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade);
b.HasOne("RC1toRC2.Models.ApplicationUser") b.HasOne("RC1toRC2.Models.ApplicationUser")
.WithMany() .WithMany()
- .HasForeignKey("UserId"); + .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
}); });
} }
} }
Oops, something went wrong.

0 comments on commit 17ca23f

Please sign in to comment.