Browse Source

Delete UI is in place.

Edit UI is in progress.
Updated to .NET Framework 4.6.2
Update Default to use new framework features.

Most of the form is there.
Still need the combo boxes loading correctly
pull/136/head
Bill Wagner 8 years ago
parent
commit
e4ee9a7d24
94 changed files with 3134 additions and 318 deletions
  1. +6
    -22
      src/Web/Catalog.WebForms/Catalog.WebForms.sln
  2. +0
    -3
      src/Web/Catalog.WebForms/Catalog.WebForms/.dockerignore
  3. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx
  4. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs
  5. +7
    -5
      src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs
  6. +28
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx
  7. +34
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.cs
  8. +33
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs
  9. +18
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx
  10. +37
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.cs
  11. +43
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs
  12. +39
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx
  13. +40
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.cs
  14. +60
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs
  15. +8
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx
  16. +17
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.cs
  17. +17
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs
  18. +65
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx
  19. +61
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.cs
  20. +78
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs
  21. +80
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx
  22. +128
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs
  23. +42
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs
  24. +42
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx
  25. +62
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.cs
  26. +24
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs
  27. +93
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx
  28. +98
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.cs
  29. +105
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs
  30. +22
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx
  31. +43
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.cs
  32. +24
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs
  33. +45
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx
  34. +36
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.cs
  35. +51
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs
  36. +33
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx
  37. +130
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.cs
  38. +24
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs
  39. +45
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx
  40. +46
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.cs
  41. +51
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs
  42. +8
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx
  43. +8
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.cs
  44. +24
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs
  45. +50
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx
  46. +77
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.cs
  47. +105
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs
  48. +28
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx
  49. +50
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.cs
  50. +42
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs
  51. +12
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config
  52. +2
    -2
      src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs
  53. +102
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/IdentityConfig.cs
  54. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs
  55. +69
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/Startup.Auth.cs
  56. +191
    -12
      src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj
  57. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx
  58. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs
  59. +7
    -5
      src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs
  60. +12
    -5
      src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css
  61. +2
    -2
      src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css
  62. +17
    -29
      src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx
  63. +15
    -13
      src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs
  64. +1
    -10
      src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs
  65. +0
    -4
      src/Web/Catalog.WebForms/Catalog.WebForms/Dockerfile
  66. +41
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx
  67. +72
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs
  68. +24
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs
  69. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax
  70. +5
    -3
      src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs
  71. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs
  72. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs
  73. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs
  74. +100
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Models/IdentityModels.cs
  75. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs
  76. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs
  77. +31
    -26
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master
  78. +66
    -2
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs
  79. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs
  80. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master
  81. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs
  82. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs
  83. +12
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs
  84. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx
  85. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs
  86. +1
    -1
      src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs
  87. +87
    -14
      src/Web/Catalog.WebForms/Catalog.WebForms/Web.config
  88. +41
    -26
      src/Web/Catalog.WebForms/Catalog.WebForms/packages.config
  89. +0
    -1
      src/Web/Catalog.WebForms/docker-compose.ci.build.yml
  90. +0
    -22
      src/Web/Catalog.WebForms/docker-compose.dcproj
  91. +0
    -23
      src/Web/Catalog.WebForms/docker-compose.override.yml
  92. +0
    -28
      src/Web/Catalog.WebForms/docker-compose.vs.debug.yml
  93. +0
    -21
      src/Web/Catalog.WebForms/docker-compose.vs.release.yml
  94. +0
    -22
      src/Web/Catalog.WebForms/docker-compose.yml

+ 6
- 22
src/Web/Catalog.WebForms/Catalog.WebForms.sln View File

@ -1,17 +1,9 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26228.0
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catalog.WebForms", "Catalog.WebForms\Catalog.WebForms.csproj", "{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}"
ProjectSection(ProjectDependencies) = postProject
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB} = {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD} = {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catalog.API", "..\..\Services\Catalog\Catalog.API\Catalog.API.csproj", "{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catalog.WebForms", "Catalog.WebForms\Catalog.WebForms.csproj", "{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -19,18 +11,10 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.Build.0 = Release|Any CPU
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.Build.0 = Release|Any CPU
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.Build.0 = Release|Any CPU
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE


+ 0
- 3
src/Web/Catalog.WebForms/Catalog.WebForms/.dockerignore View File

@ -1,3 +0,0 @@
*
!obj\Docker\publish\*
!obj\Docker\empty\

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx View File

@ -1,4 +1,4 @@
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.About" %>
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.About" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2> <h2><%: Title %>.</h2>


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs View File

@ -5,7 +5,7 @@ using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class About : Page public partial class About : Page
{ {


+ 7
- 5
src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs View File

@ -3,13 +3,15 @@
// This code was generated by a tool. // This code was generated by a tool.
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
public partial class About {
namespace eShopOnContainers.Catalog.WebForms
{
public partial class About
{
} }
} }

+ 28
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx View File

@ -0,0 +1,28 @@
<%@ Page Title="Phone Number" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddPhoneNumber.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.AddPhoneNumber" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<div class="form-horizontal">
<h4>Add a phone number</h4>
<hr />
<asp:ValidationSummary runat="server" CssClass="text-danger" />
<p class="text-danger">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="PhoneNumber" CssClass="col-md-2 control-label">Phone Number</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="PhoneNumber" CssClass="form-control" TextMode="Phone" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="PhoneNumber"
CssClass="text-danger" ErrorMessage="The PhoneNumber field is required." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="PhoneNumber_Click"
Text="Submit" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:Content>

+ 34
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.cs View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using System.Threading.Tasks;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class AddPhoneNumber : System.Web.UI.Page
{
protected void PhoneNumber_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var code = manager.GenerateChangePhoneNumberToken(User.Identity.GetUserId(), PhoneNumber.Text);
if (manager.SmsService != null)
{
var message = new IdentityMessage
{
Destination = PhoneNumber.Text,
Body = "Your security code is " + code
};
manager.SmsService.Send(message);
}
Response.Redirect("/Account/VerifyPhoneNumber?PhoneNumber=" + HttpUtility.UrlEncode(PhoneNumber.Text));
}
}
}

+ 33
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs View File

@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class AddPhoneNumber {
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal ErrorMessage;
/// <summary>
/// PhoneNumber control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox PhoneNumber;
}
}

+ 18
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx View File

@ -0,0 +1,18 @@
<%@ Page Title="Account Confirmation" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Confirm.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Confirm" Async="true" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<div>
<asp:PlaceHolder runat="server" ID="successPanel" ViewStateMode="Disabled" Visible="true">
<p>
Thank you for confirming your account. Click <asp:HyperLink ID="login" runat="server" NavigateUrl="~/Account/Login">here</asp:HyperLink> to login
</p>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="errorPanel" ViewStateMode="Disabled" Visible="false">
<p class="text-danger">
An error has occurred.
</p>
</asp:PlaceHolder>
</div>
</asp:Content>

+ 37
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.cs View File

@ -0,0 +1,37 @@
using System;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Confirm : Page
{
protected string StatusMessage
{
get;
private set;
}
protected void Page_Load(object sender, EventArgs e)
{
string code = IdentityHelper.GetCodeFromRequest(Request);
string userId = IdentityHelper.GetUserIdFromRequest(Request);
if (code != null && userId != null)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var result = manager.ConfirmEmail(userId, code);
if (result.Succeeded)
{
successPanel.Visible = true;
return;
}
}
successPanel.Visible = false;
errorPanel.Visible = true;
}
}
}

+ 43
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs View File

@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class Confirm {
/// <summary>
/// successPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder successPanel;
/// <summary>
/// login control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink login;
/// <summary>
/// errorPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder errorPanel;
}
}

+ 39
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx View File

@ -0,0 +1,39 @@
<%@ Page Title="Forgot password" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Forgot.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.ForgotPassword" Async="true" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<div class="row">
<div class="col-md-8">
<asp:PlaceHolder id="loginForm" runat="server">
<div class="form-horizontal">
<h4>Forgot your password?</h4>
<hr />
<asp:PlaceHolder runat="server" ID="ErrorMessage" Visible="false">
<p class="text-danger">
<asp:Literal runat="server" ID="FailureText" />
</p>
</asp:PlaceHolder>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
CssClass="text-danger" ErrorMessage="The email field is required." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="Forgot" Text="Email Link" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="DisplayEmail" Visible="false">
<p class="text-info">
Please check your email to reset your password.
</p>
</asp:PlaceHolder>
</div>
</div>
</asp:Content>

+ 40
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.cs View File

@ -0,0 +1,40 @@
using System;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class ForgotPassword : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Forgot(object sender, EventArgs e)
{
if (IsValid)
{
// Validate the user's email address
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
ApplicationUser user = manager.FindByName(Email.Text);
if (user == null || !manager.IsEmailConfirmed(user.Id))
{
FailureText.Text = "The user either does not exist or is not confirmed.";
ErrorMessage.Visible = true;
return;
}
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
// Send email with the code and the redirect to reset password page
//string code = manager.GeneratePasswordResetToken(user.Id);
//string callbackUrl = IdentityHelper.GetResetPasswordRedirectUrl(code, Request);
//manager.SendEmail(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>.");
loginForm.Visible = false;
DisplayEmail.Visible = true;
}
}
}
}

+ 60
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs View File

@ -0,0 +1,60 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class ForgotPassword {
/// <summary>
/// loginForm control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder loginForm;
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage;
/// <summary>
/// FailureText control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal FailureText;
/// <summary>
/// Email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Email;
/// <summary>
/// DisplayEmail control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder DisplayEmail;
}
}

+ 8
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx View File

@ -0,0 +1,8 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Lockout.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Lockout" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<hgroup>
<h1>Locked out.</h1>
<h2 class="text-danger">This account has been locked out, please try again later.</h2>
</hgroup>
</asp:Content>

+ 17
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.cs View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Lockout : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}

+ 17
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs View File

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Lockout
{
}
}

+ 65
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx View File

@ -0,0 +1,65 @@
<%@ Page Title="Log in" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Login" Async="true" %>
<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<div class="row">
<div class="col-md-8">
<section id="loginForm">
<div class="form-horizontal">
<h4>Use a local account to log in.</h4>
<hr />
<asp:PlaceHolder runat="server" ID="ErrorMessage" Visible="false">
<p class="text-danger">
<asp:Literal runat="server" ID="FailureText" />
</p>
</asp:PlaceHolder>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
CssClass="text-danger" ErrorMessage="The email field is required." />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-2 control-label">Password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Password" CssClass="text-danger" ErrorMessage="The password field is required." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<asp:CheckBox runat="server" ID="RememberMe" />
<asp:Label runat="server" AssociatedControlID="RememberMe">Remember me?</asp:Label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="LogIn" Text="Log in" CssClass="btn btn-default" />
</div>
</div>
</div>
<p>
<asp:HyperLink runat="server" ID="RegisterHyperLink" ViewStateMode="Disabled">Register as a new user</asp:HyperLink>
</p>
<p>
<%-- Enable this once you have account confirmation enabled for password reset functionality
<asp:HyperLink runat="server" ID="ForgotPasswordHyperLink" ViewStateMode="Disabled">Forgot your password?</asp:HyperLink>
--%>
</p>
</section>
</div>
<div class="col-md-4">
<section id="socialLoginForm">
<uc:OpenAuthProviders runat="server" ID="OpenAuthLogin" />
</section>
</div>
</div>
</asp:Content>

+ 61
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.cs View File

@ -0,0 +1,61 @@
using System;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Login : Page
{
protected void Page_Load(object sender, EventArgs e)
{
RegisterHyperLink.NavigateUrl = "Register";
// Enable this once you have account confirmation enabled for password reset functionality
//ForgotPasswordHyperLink.NavigateUrl = "Forgot";
OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];
var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
if (!String.IsNullOrEmpty(returnUrl))
{
RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
}
}
protected void LogIn(object sender, EventArgs e)
{
if (IsValid)
{
// Validate the user password
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
// This doen't count login failures towards account lockout
// To enable password failures to trigger lockout, change to shouldLockout: true
var result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout: false);
switch (result)
{
case SignInStatus.Success:
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
break;
case SignInStatus.LockedOut:
Response.Redirect("/Account/Lockout");
break;
case SignInStatus.RequiresVerification:
Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}",
Request.QueryString["ReturnUrl"],
RememberMe.Checked),
true);
break;
case SignInStatus.Failure:
default:
FailureText.Text = "Invalid login attempt";
ErrorMessage.Visible = true;
break;
}
}
}
}
}

+ 78
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs View File

@ -0,0 +1,78 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class Login {
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage;
/// <summary>
/// FailureText control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal FailureText;
/// <summary>
/// Email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Email;
/// <summary>
/// Password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Password;
/// <summary>
/// RememberMe control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox RememberMe;
/// <summary>
/// RegisterHyperLink control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink RegisterHyperLink;
/// <summary>
/// OpenAuthLogin control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::eShopOnContainers.Catalog.WebForms.Account.OpenAuthProviders OpenAuthLogin;
}
}

+ 80
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx View File

@ -0,0 +1,80 @@
<%@ Page Title="Manage Account" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Manage.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Manage" %>
<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<div>
<asp:PlaceHolder runat="server" ID="successMessage" Visible="false" ViewStateMode="Disabled">
<p class="text-success"><%: SuccessMessage %></p>
</asp:PlaceHolder>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-horizontal">
<h4>Change your account settings</h4>
<hr />
<dl class="dl-horizontal">
<dt>Password:</dt>
<dd>
<asp:HyperLink NavigateUrl="/Account/ManagePassword" Text="[Change]" Visible="false" ID="ChangePassword" runat="server" />
<asp:HyperLink NavigateUrl="/Account/ManagePassword" Text="[Create]" Visible="false" ID="CreatePassword" runat="server" />
</dd>
<dt>External Logins:</dt>
<dd><%: LoginsCount %>
<asp:HyperLink NavigateUrl="/Account/ManageLogins" Text="[Manage]" runat="server" />
</dd>
<%--
Phone Numbers can used as a second factor of verification in a two-factor authentication system.
See <a href="https://go.microsoft.com/fwlink/?LinkId=403804">this article</a>
for details on setting up this ASP.NET application to support two-factor authentication using SMS.
Uncomment the following blocks after you have set up two-factor authentication
--%>
<%--
<dt>Phone Number:</dt>
<% if (HasPhoneNumber)
{ %>
<dd>
<asp:HyperLink NavigateUrl="/Account/AddPhoneNumber" runat="server" Text="[Add]" />
</dd>
<% }
else
{ %>
<dd>
<asp:Label Text="" ID="PhoneNumber" runat="server" />
<asp:HyperLink NavigateUrl="/Account/AddPhoneNumber" runat="server" Text="[Change]" /> &nbsp;|&nbsp;
<asp:LinkButton Text="[Remove]" OnClick="RemovePhone_Click" runat="server" />
</dd>
<% } %>
--%>
<dt>Two-Factor Authentication:</dt>
<dd>
<p>
There are no two-factor authentication providers configured. See <a href="https://go.microsoft.com/fwlink/?LinkId=403804">this article</a>
for details on setting up this ASP.NET application to support two-factor authentication.
</p>
<% if (TwoFactorEnabled)
{ %>
<%--
Enabled
<asp:LinkButton Text="[Disable]" runat="server" CommandArgument="false" OnClick="TwoFactorDisable_Click" />
--%>
<% }
else
{ %>
<%--
Disabled
<asp:LinkButton Text="[Enable]" CommandArgument="true" OnClick="TwoFactorEnable_Click" runat="server" />
--%>
<% } %>
</dd>
</dl>
</div>
</div>
</div>
</asp:Content>

+ 128
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs View File

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Manage : System.Web.UI.Page
{
protected string SuccessMessage
{
get;
private set;
}
private bool HasPassword(ApplicationUserManager manager)
{
return manager.HasPassword(User.Identity.GetUserId());
}
public bool HasPhoneNumber { get; private set; }
public bool TwoFactorEnabled { get; private set; }
public bool TwoFactorBrowserRemembered { get; private set; }
public int LoginsCount { get; set; }
protected void Page_Load()
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
HasPhoneNumber = String.IsNullOrEmpty(manager.GetPhoneNumber(User.Identity.GetUserId()));
// Enable this after setting up two-factor authentientication
//PhoneNumber.Text = manager.GetPhoneNumber(User.Identity.GetUserId()) ?? String.Empty;
TwoFactorEnabled = manager.GetTwoFactorEnabled(User.Identity.GetUserId());
LoginsCount = manager.GetLogins(User.Identity.GetUserId()).Count;
var authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
if (!IsPostBack)
{
// Determine the sections to render
if (HasPassword(manager))
{
ChangePassword.Visible = true;
}
else
{
CreatePassword.Visible = true;
ChangePassword.Visible = false;
}
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The account was removed."
: message == "AddPhoneNumberSuccess" ? "Phone number has been added"
: message == "RemovePhoneNumberSuccess" ? "Phone number was removed"
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
}
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
// Remove phonenumber from user
protected void RemovePhone_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var result = manager.SetPhoneNumber(User.Identity.GetUserId(), null);
if (!result.Succeeded)
{
return;
}
var user = manager.FindById(User.Identity.GetUserId());
if (user != null)
{
signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
Response.Redirect("/Account/Manage?m=RemovePhoneNumberSuccess");
}
}
// DisableTwoFactorAuthentication
protected void TwoFactorDisable_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
manager.SetTwoFactorEnabled(User.Identity.GetUserId(), false);
Response.Redirect("/Account/Manage");
}
//EnableTwoFactorAuthentication
protected void TwoFactorEnable_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
manager.SetTwoFactorEnabled(User.Identity.GetUserId(), true);
Response.Redirect("/Account/Manage");
}
}
}

+ 42
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class Manage {
/// <summary>
/// successMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder successMessage;
/// <summary>
/// ChangePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink ChangePassword;
/// <summary>
/// CreatePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink CreatePassword;
}
}

+ 42
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx View File

@ -0,0 +1,42 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageLogins.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.ManageLogins" %>
<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Manage your external logins.</h2>
<asp:PlaceHolder runat="server" ID="successMessage" Visible="false" ViewStateMode="Disabled">
<p class="text-success"><%: SuccessMessage %></p>
</asp:PlaceHolder>
<div>
<section id="externalLoginsForm">
<asp:ListView runat="server"
ItemType="Microsoft.AspNet.Identity.UserLoginInfo"
SelectMethod="GetLogins" DeleteMethod="RemoveLogin" DataKeyNames="LoginProvider,ProviderKey">
<LayoutTemplate>
<h4>Registered Logins</h4>
<table class="table">
<tbody>
<tr runat="server" id="itemPlaceholder"></tr>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><%#: Item.LoginProvider %></td>
<td>
<asp:Button runat="server" Text="Remove" CommandName="Delete" CausesValidation="false"
ToolTip='<%# "Remove this " + Item.LoginProvider + " login from your account" %>'
Visible="<%# CanRemoveExternalLogins %>" CssClass="btn btn-default" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</section>
</div>
<div>
<uc:OpenAuthProviders runat="server" ReturnUrl="~/Account/ManageLogins" />
</div>
</asp:Content>

+ 62
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.cs View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class ManageLogins : System.Web.UI.Page
{
protected string SuccessMessage
{
get;
private set;
}
protected bool CanRemoveExternalLogins
{
get;
private set;
}
private bool HasPassword(ApplicationUserManager manager)
{
return manager.HasPassword(User.Identity.GetUserId());
}
protected void Page_Load(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1;
SuccessMessage = String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
public IEnumerable<UserLoginInfo> GetLogins()
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var accounts = manager.GetLogins(User.Identity.GetUserId());
CanRemoveExternalLogins = accounts.Count() > 1 || HasPassword(manager);
return accounts;
}
public void RemoveLogin(string loginProvider, string providerKey)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var result = manager.RemoveLogin(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
string msg = String.Empty;
if (result.Succeeded)
{
var user = manager.FindById(User.Identity.GetUserId());
signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
msg = "?m=RemoveLoginSuccess";
}
Response.Redirect("~/Account/ManageLogins" + msg);
}
}
}

+ 24
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class ManageLogins {
/// <summary>
/// successMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder successMessage;
}
}

+ 93
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx View File

@ -0,0 +1,93 @@
<%@ Page Title="Manage Password" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManagePassword.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.ManagePassword" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<div class="form-horizontal">
<section id="passwordForm">
<asp:PlaceHolder runat="server" ID="setPassword" Visible="false">
<p>
You do not have a local password for this site. Add a local
password so you can log in without an external login.
</p>
<div class="form-horizontal">
<h4>Set Password Form</h4>
<asp:ValidationSummary runat="server" ShowModelStateErrors="true" CssClass="text-danger" />
<hr />
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="password" CssClass="col-md-2 control-label">Password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="password" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="password"
CssClass="text-danger" ErrorMessage="The password field is required."
Display="Dynamic" ValidationGroup="SetPassword" />
<asp:ModelErrorMessage runat="server" ModelStateKey="NewPassword" AssociatedControlID="password"
CssClass="text-danger" SetFocusOnError="true" />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="confirmPassword" CssClass="col-md-2 control-label">Confirm password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="confirmPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="confirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The confirm password field is required."
ValidationGroup="SetPassword" />
<asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="confirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The password and confirmation password do not match."
ValidationGroup="SetPassword" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" Text="Set Password" ValidationGroup="SetPassword" OnClick="SetPassword_Click" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="changePasswordHolder" Visible="false">
<div class="form-horizontal">
<h4>Change Password Form</h4>
<hr />
<asp:ValidationSummary runat="server" ShowModelStateErrors="true" CssClass="text-danger" />
<div class="form-group">
<asp:Label runat="server" ID="CurrentPasswordLabel" AssociatedControlID="CurrentPassword" CssClass="col-md-2 control-label">Current password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="CurrentPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="CurrentPassword"
CssClass="text-danger" ErrorMessage="The current password field is required."
ValidationGroup="ChangePassword" />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" ID="NewPasswordLabel" AssociatedControlID="NewPassword" CssClass="col-md-2 control-label">New password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="NewPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="NewPassword"
CssClass="text-danger" ErrorMessage="The new password is required."
ValidationGroup="ChangePassword" />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" ID="ConfirmNewPasswordLabel" AssociatedControlID="ConfirmNewPassword" CssClass="col-md-2 control-label">Confirm new password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="ConfirmNewPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmNewPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="Confirm new password is required."
ValidationGroup="ChangePassword" />
<asp:CompareValidator runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The new password and confirmation password do not match."
ValidationGroup="ChangePassword" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" Text="Change Password" ValidationGroup="ChangePassword" OnClick="ChangePassword_Click" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:PlaceHolder>
</section>
</div>
</asp:Content>

+ 98
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.cs View File

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class ManagePassword : System.Web.UI.Page
{
protected string SuccessMessage
{
get;
private set;
}
private bool HasPassword(ApplicationUserManager manager)
{
return manager.HasPassword(User.Identity.GetUserId());
}
protected void Page_Load(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
if (!IsPostBack)
{
// Determine the sections to render
if (HasPassword(manager))
{
changePasswordHolder.Visible = true;
}
else
{
setPassword.Visible = true;
changePasswordHolder.Visible = false;
}
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
}
}
}
protected void ChangePassword_Click(object sender, EventArgs e)
{
if (IsValid)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
IdentityResult result = manager.ChangePassword(User.Identity.GetUserId(), CurrentPassword.Text, NewPassword.Text);
if (result.Succeeded)
{
var user = manager.FindById(User.Identity.GetUserId());
signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
Response.Redirect("~/Account/Manage?m=ChangePwdSuccess");
}
else
{
AddErrors(result);
}
}
}
protected void SetPassword_Click(object sender, EventArgs e)
{
if (IsValid)
{
// Create the local login info and link the local account to the user
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
IdentityResult result = manager.AddPassword(User.Identity.GetUserId(), password.Text);
if (result.Succeeded)
{
Response.Redirect("~/Account/Manage?m=SetPwdSuccess");
}
else
{
AddErrors(result);
}
}
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
}
}

+ 105
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs View File

@ -0,0 +1,105 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class ManagePassword {
/// <summary>
/// setPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder setPassword;
/// <summary>
/// password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox password;
/// <summary>
/// confirmPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox confirmPassword;
/// <summary>
/// changePasswordHolder control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder changePasswordHolder;
/// <summary>
/// CurrentPasswordLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label CurrentPasswordLabel;
/// <summary>
/// CurrentPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox CurrentPassword;
/// <summary>
/// NewPasswordLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label NewPasswordLabel;
/// <summary>
/// NewPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox NewPassword;
/// <summary>
/// ConfirmNewPasswordLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label ConfirmNewPasswordLabel;
/// <summary>
/// ConfirmNewPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox ConfirmNewPassword;
}
}

+ 22
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx View File

@ -0,0 +1,22 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OpenAuthProviders.ascx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.OpenAuthProviders" %>
<div id="socialLoginList">
<h4>Use another service to log in.</h4>
<hr />
<asp:ListView runat="server" ID="providerDetails" ItemType="System.String"
SelectMethod="GetProviderNames" ViewStateMode="Disabled">
<ItemTemplate>
<p>
<button type="submit" class="btn btn-default" name="provider" value="<%#: Item %>"
title="Log in using your <%#: Item %> account.">
<%#: Item %>
</button>
</p>
</ItemTemplate>
<EmptyDataTemplate>
<div>
<p>There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkId=252803">this article</a> for details on setting up this ASP.NET application to support logging in via external services.</p>
</div>
</EmptyDataTemplate>
</asp:ListView>
</div>

+ 43
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.cs View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class OpenAuthProviders : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
var provider = Request.Form["provider"];
if (provider == null)
{
return;
}
// Request a redirect to the external login provider
string redirectUrl = ResolveUrl(String.Format(CultureInfo.InvariantCulture, "~/Account/RegisterExternalLogin?{0}={1}&returnUrl={2}", IdentityHelper.ProviderNameKey, provider, ReturnUrl));
var properties = new AuthenticationProperties() { RedirectUri = redirectUrl };
// Add xsrf verification when linking accounts
if (Context.User.Identity.IsAuthenticated)
{
properties.Dictionary[IdentityHelper.XsrfKey] = Context.User.Identity.GetUserId();
}
Context.GetOwinContext().Authentication.Challenge(properties, provider);
Response.StatusCode = 401;
Response.End();
}
}
public string ReturnUrl { get; set; }
public IEnumerable<string> GetProviderNames()
{
return Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes().Select(t => t.AuthenticationType);
}
}
}

+ 24
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class OpenAuthProviders {
/// <summary>
/// providerDetails control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ListView providerDetails;
}
}

+ 45
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx View File

@ -0,0 +1,45 @@
<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Register" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<p class="text-danger">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<div class="form-horizontal">
<h4>Create a new account</h4>
<hr />
<asp:ValidationSummary runat="server" CssClass="text-danger" />
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
CssClass="text-danger" ErrorMessage="The email field is required." />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-2 control-label">Password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
CssClass="text-danger" ErrorMessage="The password field is required." />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="ConfirmPassword" CssClass="col-md-2 control-label">Confirm password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The confirm password field is required." />
<asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="CreateUser_Click" Text="Register" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:Content>

+ 36
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.cs View File

@ -0,0 +1,36 @@
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
//string code = manager.GenerateEmailConfirmationToken(user.Id);
//string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
//manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");
signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else
{
ErrorMessage.Text = result.Errors.FirstOrDefault();
}
}
}
}

+ 51
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs View File

@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class Register {
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal ErrorMessage;
/// <summary>
/// Email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Email;
/// <summary>
/// Password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Password;
/// <summary>
/// ConfirmPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox ConfirmPassword;
}
}

+ 33
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx View File

@ -0,0 +1,33 @@
<%@ Page Title="Register an external login" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RegisterExternalLogin.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.RegisterExternalLogin" Async="true" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h3>Register with your <%: ProviderName %> account</h3>
<asp:PlaceHolder runat="server">
<div class="form-horizontal">
<h4>Association Form</h4>
<hr />
<asp:ValidationSummary runat="server" ShowModelStateErrors="true" CssClass="text-danger" />
<p class="text-info">
You've authenticated with <strong><%: ProviderName %></strong>. Please enter an email below for the current site
and click the Log in button.
</p>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="email" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="email" CssClass="form-control" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="email"
Display="Dynamic" CssClass="text-danger" ErrorMessage="Email is required" />
<asp:ModelErrorMessage runat="server" ModelStateKey="email" CssClass="text-error" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" Text="Log in" CssClass="btn btn-default" OnClick="LogIn_Click" />
</div>
</div>
</div>
</asp:PlaceHolder>
</asp:Content>

+ 130
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.cs View File

@ -0,0 +1,130 @@
using System;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class RegisterExternalLogin : System.Web.UI.Page
{
protected string ProviderName
{
get { return (string)ViewState["ProviderName"] ?? String.Empty; }
private set { ViewState["ProviderName"] = value; }
}
protected string ProviderAccountKey
{
get { return (string)ViewState["ProviderAccountKey"] ?? String.Empty; }
private set { ViewState["ProviderAccountKey"] = value; }
}
private void RedirectOnFail()
{
Response.Redirect((User.Identity.IsAuthenticated) ? "~/Account/Manage" : "~/Account/Login");
}
protected void Page_Load()
{
// Process the result from an auth provider in the request
ProviderName = IdentityHelper.GetProviderNameFromRequest(Request);
if (String.IsNullOrEmpty(ProviderName))
{
RedirectOnFail();
return;
}
if (!IsPostBack)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var loginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo();
if (loginInfo == null)
{
RedirectOnFail();
return;
}
var user = manager.Find(loginInfo.Login);
if (user != null)
{
signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else if (User.Identity.IsAuthenticated)
{
// Apply Xsrf check when linking
var verifiedloginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo(IdentityHelper.XsrfKey, User.Identity.GetUserId());
if (verifiedloginInfo == null)
{
RedirectOnFail();
return;
}
var result = manager.AddLogin(User.Identity.GetUserId(), verifiedloginInfo.Login);
if (result.Succeeded)
{
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else
{
AddErrors(result);
return;
}
}
else
{
email.Text = loginInfo.Email;
}
}
}
protected void LogIn_Click(object sender, EventArgs e)
{
CreateAndLoginUser();
}
private void CreateAndLoginUser()
{
if (!IsValid)
{
return;
}
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = email.Text, Email = email.Text };
IdentityResult result = manager.Create(user);
if (result.Succeeded)
{
var loginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo();
if (loginInfo == null)
{
RedirectOnFail();
return;
}
result = manager.AddLogin(user.Id, loginInfo.Login);
if (result.Succeeded)
{
signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
// var code = manager.GenerateEmailConfirmationToken(user.Id);
// Send this link via email: IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id)
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
return;
}
}
AddErrors(result);
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
}
}

+ 24
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class RegisterExternalLogin {
/// <summary>
/// email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox email;
}
}

+ 45
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx View File

@ -0,0 +1,45 @@
<%@ Page Title="Reset Password" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ResetPassword.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.ResetPassword" Async="true" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<p class="text-danger">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<div class="form-horizontal">
<h4>Enter your new password</h4>
<hr />
<asp:ValidationSummary runat="server" CssClass="text-danger" />
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
CssClass="text-danger" ErrorMessage="The email field is required." />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-2 control-label">Password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
CssClass="text-danger" ErrorMessage="The password field is required." />
</div>
</div>
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="ConfirmPassword" CssClass="col-md-2 control-label">Confirm password</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The confirm password field is required." />
<asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="Reset_Click" Text="Reset" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:Content>

+ 46
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.cs View File

@ -0,0 +1,46 @@
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class ResetPassword : Page
{
protected string StatusMessage
{
get;
private set;
}
protected void Reset_Click(object sender, EventArgs e)
{
string code = IdentityHelper.GetCodeFromRequest(Request);
if (code != null)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var user = manager.FindByName(Email.Text);
if (user == null)
{
ErrorMessage.Text = "No user found";
return;
}
var result = manager.ResetPassword(user.Id, code, Password.Text);
if (result.Succeeded)
{
Response.Redirect("~/Account/ResetPasswordConfirmation");
return;
}
ErrorMessage.Text = result.Errors.FirstOrDefault();
return;
}
ErrorMessage.Text = "An error has occurred";
}
}
}

+ 51
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs View File

@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class ResetPassword {
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal ErrorMessage;
/// <summary>
/// Email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Email;
/// <summary>
/// Password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Password;
/// <summary>
/// ConfirmPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox ConfirmPassword;
}
}

+ 8
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx View File

@ -0,0 +1,8 @@
<%@ Page Title="Password Changed" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ResetPasswordConfirmation.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.ResetPasswordConfirmation" Async="true" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2><%: Title %>.</h2>
<div>
<p>Your password has been changed. Click <asp:HyperLink ID="login" runat="server" NavigateUrl="~/Account/Login">here</asp:HyperLink> to login </p>
</div>
</asp:Content>

+ 8
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.cs View File

@ -0,0 +1,8 @@
using System.Web.UI;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class ResetPasswordConfirmation : Page
{
}
}

+ 24
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class ResetPasswordConfirmation {
/// <summary>
/// login control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink login;
}
}

+ 50
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx View File

@ -0,0 +1,50 @@
<%@ Page Title="Two-Factor Authentication" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="TwoFactorAuthenticationSignIn.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.TwoFactorAuthenticationSignIn" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<asp:PlaceHolder runat="server" ID="sendcode">
<section>
<h4>Send verification code</h4>
<hr />
<div class="row">
<div class="col-md-12">
Select Two-Factor Authentication Provider:
<asp:DropDownList runat="server" ID="Providers">
</asp:DropDownList>
<asp:Button Text="Submit" ID="ProviderSubmit" OnClick="ProviderSubmit_Click" CssClass="btn btn-default" runat="server" />
</div>
</div>
</section>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="verifycode" Visible="false">
<section>
<h4>Enter verification code</h4>
<hr />
<asp:HiddenField ID="SelectedProvider" runat="server" />
<asp:PlaceHolder runat="server" ID="ErrorMessage" Visible="false">
<p class="text-danger">
<asp:Literal runat="server" ID="FailureText" />
</p>
</asp:PlaceHolder>
<div class="form-group">
<asp:Label Text="Code:" runat="server" AssociatedControlID="Code" CssClass="col-md-2 control-label" />
<div class="col-md-10">
<asp:TextBox runat="server" ID="Code" CssClass="form-control" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<asp:Label Text="Remember Browser" runat="server" />
<asp:CheckBox Text="" ID="RememberBrowser" runat="server" />
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button Text="Submit" ID="CodeSubmit" OnClick="CodeSubmit_Click" CssClass="btn btn-default" runat="server" />
</div>
</div>
</section>
</asp:PlaceHolder>
</asp:Content>

+ 77
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.cs View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class TwoFactorAuthenticationSignIn : System.Web.UI.Page
{
private ApplicationSignInManager signinManager;
private ApplicationUserManager manager;
public TwoFactorAuthenticationSignIn()
{
manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
}
protected void Page_Load(object sender, EventArgs e)
{
var userId = signinManager.GetVerifiedUserId<ApplicationUser, string>();
if (userId == null)
{
Response.Redirect("/Account/Error", true);
}
var userFactors = manager.GetValidTwoFactorProviders(userId);
Providers.DataSource = userFactors.Select(x => x).ToList();
Providers.DataBind();
}
protected void CodeSubmit_Click(object sender, EventArgs e)
{
bool rememberMe = false;
bool.TryParse(Request.QueryString["RememberMe"], out rememberMe);
var result = signinManager.TwoFactorSignIn<ApplicationUser, string>(SelectedProvider.Value, Code.Text, isPersistent: rememberMe, rememberBrowser: RememberBrowser.Checked);
switch (result)
{
case SignInStatus.Success:
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
break;
case SignInStatus.LockedOut:
Response.Redirect("/Account/Lockout");
break;
case SignInStatus.Failure:
default:
FailureText.Text = "Invalid code";
ErrorMessage.Visible = true;
break;
}
}
protected void ProviderSubmit_Click(object sender, EventArgs e)
{
if (!signinManager.SendTwoFactorCode(Providers.SelectedValue))
{
Response.Redirect("/Account/Error");
}
var user = manager.FindById(signinManager.GetVerifiedUserId<ApplicationUser, string>());
if (user != null)
{
var code = manager.GenerateTwoFactorToken(user.Id, Providers.SelectedValue);
}
SelectedProvider.Value = Providers.SelectedValue;
sendcode.Visible = false;
verifycode.Visible = true;
}
}
}

+ 105
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs View File

@ -0,0 +1,105 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class TwoFactorAuthenticationSignIn {
/// <summary>
/// sendcode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder sendcode;
/// <summary>
/// Providers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList Providers;
/// <summary>
/// ProviderSubmit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button ProviderSubmit;
/// <summary>
/// verifycode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder verifycode;
/// <summary>
/// SelectedProvider control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField SelectedProvider;
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage;
/// <summary>
/// FailureText control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal FailureText;
/// <summary>
/// Code control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Code;
/// <summary>
/// RememberBrowser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox RememberBrowser;
/// <summary>
/// CodeSubmit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button CodeSubmit;
}
}

+ 28
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx View File

@ -0,0 +1,28 @@
<%@ Page Title="Verify Phone Number" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="VerifyPhoneNumber.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.VerifyPhoneNumber" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<p class="text-danger">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<div class="form-horizontal">
<h4>Enter verification code</h4>
<hr />
<asp:HiddenField runat="server" ID="PhoneNumber" />
<asp:ValidationSummary runat="server" CssClass="text-danger" />
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="Code" CssClass="col-md-2 control-label">Code</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="Code" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Code"
CssClass="text-danger" ErrorMessage="The Code field is required." />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<asp:Button runat="server" OnClick="Code_Click"
Text="Submit" CssClass="btn btn-default" />
</div>
</div>
</div>
</asp:Content>

+ 50
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.cs View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
namespace eShopOnContainers.Catalog.WebForms.Account
{
public partial class VerifyPhoneNumber : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var phonenumber = Request.QueryString["PhoneNumber"];
var code = manager.GenerateChangePhoneNumberToken(User.Identity.GetUserId(), phonenumber);
PhoneNumber.Value = phonenumber;
}
protected void Code_Click(object sender, EventArgs e)
{
if (!ModelState.IsValid)
{
ModelState.AddModelError("", "Invalid code");
return;
}
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var result = manager.ChangePhoneNumber(User.Identity.GetUserId(), PhoneNumber.Value, Code.Text);
if (result.Succeeded)
{
var user = manager.FindById(User.Identity.GetUserId());
if (user != null)
{
signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
Response.Redirect("/Account/Manage?m=AddPhoneNumberSuccess");
}
}
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "Failed to verify phone");
}
}
}

+ 42
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms.Account {
public partial class VerifyPhoneNumber {
/// <summary>
/// ErrorMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal ErrorMessage;
/// <summary>
/// PhoneNumber control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField PhoneNumber;
/// <summary>
/// Code control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox Code;
}
}

+ 12
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<configuration>
<location path="Manage.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>

+ 2
- 2
src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs View File

@ -5,7 +5,7 @@ using System.Web;
using System.Web.Optimization; using System.Web.Optimization;
using System.Web.UI; using System.Web.UI;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public class BundleConfig public class BundleConfig
{ {
@ -34,7 +34,7 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*")); "~/Scripts/modernizr-*"));
System.Web.UI.ScriptManager.ScriptResourceMapping.AddDefinition(
ScriptManager.ScriptResourceMapping.AddDefinition(
"respond", "respond",
new ScriptResourceDefinition new ScriptResourceDefinition
{ {


+ 102
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/IdentityConfig.cs View File

@ -0,0 +1,102 @@
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms
{
public class EmailService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your email service here to send an email.
return Task.FromResult(0);
}
}
public class SmsService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your SMS service here to send a text message.
return Task.FromResult(0);
}
}
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = true,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
};
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
// You can write your own provider and plug it in here.
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
{
MessageFormat = "Your security code is {0}"
});
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
{
Subject = "Security Code",
BodyFormat = "Your security code is {0}"
});
// Configure user lockout defaults
manager.UserLockoutEnabledByDefault = true;
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
manager.EmailService = new EmailService();
manager.SmsService = new SmsService();
var dataProtectionProvider = options.DataProtectionProvider;
if (dataProtectionProvider != null)
{
manager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
}
return manager;
}
}
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
{
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) :
base(userManager, authenticationManager) { }
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
{
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
}
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
{
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
}
}
}

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs View File

@ -4,7 +4,7 @@ using System.Web;
using System.Web.Routing; using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls; using Microsoft.AspNet.FriendlyUrls;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public static class RouteConfig public static class RouteConfig
{ {


+ 69
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/Startup.Auth.cs View File

@ -0,0 +1,69 @@
using System;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.DataProtection;
using Microsoft.Owin.Security.Google;
using Owin;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms
{
public partial class Startup {
// For more information on configuring authentication, please visit https://go.microsoft.com/fwlink/?LinkId=301883
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
// Enables the application to remember the second login verification factor such as phone or email.
// Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
// This is similar to the RememberMe option when you log in.
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
//app.UseFacebookAuthentication(
// appId: "",
// appSecret: "");
//app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
//{
// ClientId = "",
// ClientSecret = ""
//});
}
}
}

+ 191
- 12
src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj View File

@ -9,13 +9,13 @@
<ProductVersion> <ProductVersion>
</ProductVersion> </ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}</ProjectGuid>
<ProjectGuid>{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.eShopOnContainers.Catalog.WebForms</RootNamespace>
<AssemblyName>Catalog.WebForms</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<RootNamespace>eShopOnContainers.Catalog.WebForms</RootNamespace>
<AssemblyName>eShopOnContainers.Catalog.WebForms</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />
@ -44,8 +44,8 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Autofac, Version=4.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.4.3.0\lib\net45\Autofac.dll</HintPath>
<Reference Include="Autofac, Version=4.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.4.4.0\lib\net45\Autofac.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
@ -106,6 +106,54 @@
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="EntityFramework">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Owin">
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="System.Web.Providers">
<HintPath>..\packages\Microsoft.AspNet.Providers.Core.2.0.0\lib\net40\System.Web.Providers.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security">
<HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Facebook">
<HintPath>..\packages\Microsoft.Owin.Security.Facebook.3.0.1\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Cookies">
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Google">
<HintPath>..\packages\Microsoft.Owin.Security.Google.3.0.1\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Twitter">
<HintPath>..\packages\Microsoft.Owin.Security.Twitter.3.0.1\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.MicrosoftAccount">
<HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.3.0.1\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.OAuth">
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationInsights"> <Reference Include="Microsoft.ApplicationInsights">
<HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath> <HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
</Reference> </Reference>
@ -130,10 +178,26 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="About.aspx" /> <Content Include="About.aspx" />
<Content Include="Account\AddPhoneNumber.aspx" />
<Content Include="Account\Confirm.aspx" />
<Content Include="Account\Forgot.aspx" />
<Content Include="Account\Lockout.aspx" />
<Content Include="Account\Login.aspx" />
<Content Include="Account\Manage.aspx" />
<Content Include="Account\ManageLogins.aspx" />
<Content Include="Account\ManagePassword.aspx" />
<Content Include="Account\OpenAuthProviders.ascx" />
<Content Include="Account\Register.aspx" />
<Content Include="Account\RegisterExternalLogin.aspx" />
<Content Include="Account\ResetPassword.aspx" />
<Content Include="Account\ResetPasswordConfirmation.aspx" />
<Content Include="Account\TwoFactorAuthenticationSignIn.aspx" />
<Content Include="Account\VerifyPhoneNumber.aspx" />
<Content Include="Contact.aspx" /> <Content Include="Contact.aspx" />
<Content Include="Content\app.component.css" /> <Content Include="Content\app.component.css" />
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="Content\brand.png" />
<Content Include="Content\brand_dark.png" /> <Content Include="Content\brand_dark.png" />
<Content Include="Content\catalog.component.css" /> <Content Include="Content\catalog.component.css" />
<Content Include="Content\fake_product_01.png" /> <Content Include="Content\fake_product_01.png" />
@ -141,22 +205,21 @@
<Content Include="Content\fake_product_03.png" /> <Content Include="Content\fake_product_03.png" />
<Content Include="Content\fake_product_04.png" /> <Content Include="Content\fake_product_04.png" />
<Content Include="Content\fake_product_05.png" /> <Content Include="Content\fake_product_05.png" />
<Content Include="Content\main_banner.png" />
<Content Include="Content\main_banner_text.png" />
<Content Include="Content\Site.css" /> <Content Include="Content\Site.css" />
<Content Include="Default.aspx" /> <Content Include="Default.aspx" />
<Content Include="EditCatalogItem.aspx" />
<Content Include="favicon.ico" /> <Content Include="favicon.ico" />
<Content Include="fonts\glyphicons-halflings-regular.svg" /> <Content Include="fonts\glyphicons-halflings-regular.svg" />
<Content Include="Global.asax" /> <Content Include="Global.asax" />
<Content Include="fonts\glyphicons-halflings-regular.woff" /> <Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="fonts\glyphicons-halflings-regular.ttf" /> <Content Include="fonts\glyphicons-halflings-regular.ttf" />
<Content Include="fonts\glyphicons-halflings-regular.eot" /> <Content Include="fonts\glyphicons-halflings-regular.eot" />
<Content Include="Account\Web.config" />
<Content Include="ApplicationInsights.config"> <Content Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="Dockerfile" />
<None Include=".dockerignore">
<DependentUpon>Dockerfile</DependentUpon>
</None>
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Scripts\jquery-1.10.2.intellisense.js" /> <None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
@ -193,6 +256,111 @@
<Content Include="Site.Mobile.Master" /> <Content Include="Site.Mobile.Master" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Account\AddPhoneNumber.aspx.cs">
<DependentUpon>AddPhoneNumber.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\AddPhoneNumber.aspx.designer.cs">
<DependentUpon>AddPhoneNumber.aspx</DependentUpon>
</Compile>
<Compile Include="Account\Confirm.aspx.cs">
<DependentUpon>Confirm.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Confirm.aspx.designer.cs">
<DependentUpon>Confirm.aspx</DependentUpon>
</Compile>
<Compile Include="Account\Forgot.aspx.cs">
<DependentUpon>Forgot.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Forgot.aspx.designer.cs">
<DependentUpon>Forgot.aspx</DependentUpon>
</Compile>
<Compile Include="Account\Lockout.aspx.cs">
<DependentUpon>Lockout.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Lockout.aspx.designer.cs">
<DependentUpon>Lockout.aspx</DependentUpon>
</Compile>
<Compile Include="Account\Login.aspx.cs">
<DependentUpon>Login.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Login.aspx.designer.cs">
<DependentUpon>Login.aspx</DependentUpon>
</Compile>
<Compile Include="Account\Manage.aspx.cs">
<DependentUpon>Manage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Manage.aspx.designer.cs">
<DependentUpon>Manage.aspx</DependentUpon>
</Compile>
<Compile Include="Account\ManageLogins.aspx.cs">
<DependentUpon>ManageLogins.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\ManageLogins.aspx.designer.cs">
<DependentUpon>ManageLogins.aspx</DependentUpon>
</Compile>
<Compile Include="Account\ManagePassword.aspx.cs">
<DependentUpon>ManagePassword.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\ManagePassword.aspx.designer.cs">
<DependentUpon>ManagePassword.aspx</DependentUpon>
</Compile>
<Compile Include="Account\OpenAuthProviders.ascx.cs">
<DependentUpon>OpenAuthProviders.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\OpenAuthProviders.ascx.designer.cs">
<DependentUpon>OpenAuthProviders.ascx</DependentUpon>
</Compile>
<Compile Include="Account\Register.aspx.cs">
<DependentUpon>Register.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\Register.aspx.designer.cs">
<DependentUpon>Register.aspx</DependentUpon>
</Compile>
<Compile Include="Account\RegisterExternalLogin.aspx.cs">
<DependentUpon>RegisterExternalLogin.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\RegisterExternalLogin.aspx.designer.cs">
<DependentUpon>RegisterExternalLogin.aspx</DependentUpon>
</Compile>
<Compile Include="Account\ResetPassword.aspx.cs">
<DependentUpon>ResetPassword.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\ResetPassword.aspx.designer.cs">
<DependentUpon>ResetPassword.aspx</DependentUpon>
</Compile>
<Compile Include="Account\ResetPasswordConfirmation.aspx.cs">
<DependentUpon>ResetPasswordConfirmation.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\ResetPasswordConfirmation.aspx.designer.cs">
<DependentUpon>ResetPasswordConfirmation.aspx</DependentUpon>
</Compile>
<Compile Include="Account\TwoFactorAuthenticationSignIn.aspx.cs">
<DependentUpon>TwoFactorAuthenticationSignIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\TwoFactorAuthenticationSignIn.aspx.designer.cs">
<DependentUpon>TwoFactorAuthenticationSignIn.aspx</DependentUpon>
</Compile>
<Compile Include="Account\VerifyPhoneNumber.aspx.cs">
<DependentUpon>VerifyPhoneNumber.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Account\VerifyPhoneNumber.aspx.designer.cs">
<DependentUpon>VerifyPhoneNumber.aspx</DependentUpon>
</Compile>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="About.aspx.cs"> <Compile Include="About.aspx.cs">
<DependentUpon>About.aspx</DependentUpon> <DependentUpon>About.aspx</DependentUpon>
@ -201,7 +369,9 @@
<Compile Include="About.aspx.designer.cs"> <Compile Include="About.aspx.designer.cs">
<DependentUpon>About.aspx</DependentUpon> <DependentUpon>About.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="App_Start\IdentityConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\Startup.Auth.cs" />
<Compile Include="Contact.aspx.cs"> <Compile Include="Contact.aspx.cs">
<DependentUpon>Contact.aspx</DependentUpon> <DependentUpon>Contact.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
@ -216,6 +386,13 @@
<Compile Include="Default.aspx.designer.cs"> <Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon> <DependentUpon>Default.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="EditCatalogItem.aspx.cs">
<DependentUpon>EditCatalogItem.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="EditCatalogItem.aspx.designer.cs">
<DependentUpon>EditCatalogItem.aspx</DependentUpon>
</Compile>
<Compile Include="Extensions\ObservableExtensions.cs" /> <Compile Include="Extensions\ObservableExtensions.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
@ -224,6 +401,7 @@
<Compile Include="Models\CatalogItem.cs" /> <Compile Include="Models\CatalogItem.cs" />
<Compile Include="Models\CatalogRoot.cs" /> <Compile Include="Models\CatalogRoot.cs" />
<Compile Include="Models\CatalogType.cs" /> <Compile Include="Models\CatalogType.cs" />
<Compile Include="Models\IdentityModels.cs" />
<Compile Include="Modules\AutoFacHttpModule.cs" /> <Compile Include="Modules\AutoFacHttpModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\CatalogMockService.cs" /> <Compile Include="Services\CatalogMockService.cs" />
@ -245,6 +423,7 @@
<Compile Include="Site.Mobile.Master.designer.cs"> <Compile Include="Site.Mobile.Master.designer.cs">
<DependentUpon>Site.Mobile.Master</DependentUpon> <DependentUpon>Site.Mobile.Master</DependentUpon>
</Compile> </Compile>
<Compile Include="Startup.cs" />
<Compile Include="ViewSwitcher.ascx.cs"> <Compile Include="ViewSwitcher.ascx.cs">
<DependentUpon>ViewSwitcher.ascx</DependentUpon> <DependentUpon>ViewSwitcher.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
@ -279,7 +458,7 @@
<WebProjectProperties> <WebProjectProperties>
<UseIIS>True</UseIIS> <UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>58178</DevelopmentServerPort>
<DevelopmentServerPort>55489</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:58178/</IISUrl> <IISUrl>http://localhost:58178/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx View File

@ -1,4 +1,4 @@
<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Contact.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.Contact" %>
<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Contact.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Contact" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2> <h2><%: Title %>.</h2>


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs View File

@ -5,7 +5,7 @@ using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class Contact : Page public partial class Contact : Page
{ {


+ 7
- 5
src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs View File

@ -3,13 +3,15 @@
// This code was generated by a tool. // This code was generated by a tool.
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
public partial class Contact {
namespace eShopOnContainers.Catalog.WebForms
{
public partial class Contact
{
} }
} }

+ 12
- 5
src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css View File

@ -11,20 +11,27 @@ body {
padding-right: 15px; padding-right: 15px;
} }
/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}
/* Set widths on the form inputs since otherwise they're 100% wide */ /* Set widths on the form inputs since otherwise they're 100% wide */
input,
select,
textarea {
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="select"] {
max-width: 280px; max-width: 280px;
} }
/* Responsive: Portrait tablets and up */ /* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) { @media screen and (min-width: 768px) {
.jumbotron { .jumbotron {
margin-top: 20px; margin-top: 20px;
} }
.body-content { .body-content {
padding: 0; padding: 0;
} }


+ 2
- 2
src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css View File

@ -35,7 +35,7 @@
.esh-catalog-filter option { .esh-catalog-filter option {
background-color: #00A69C; background-color: #00A69C;
} }
*/
.esh-catalog-label { .esh-catalog-label {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -63,7 +63,7 @@
width: 10px; width: 10px;
z-index: 1; z-index: 1;
} }
/*
.esh-catalog-send { .esh-catalog-send {
background-color: #83D01B; background-color: #83D01B;
color: #FFFFFF; color: #FFFFFF;


+ 17
- 29
src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx View File

@ -1,29 +1,10 @@
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms._Default" Async="true" %>
<%@ Page Title="eShopOnContainers - Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms._Default" Async="true" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<section class="esh-catalog-hero">
<div class="container">
<img class="esh-catalog-title" src="/Content/main_banner_text.png" />
</div>
</section>
<br />
<div class="row">
<span class="col-md-4">
<asp:DataPager
ID="DataPager1"
PagedControlID="catalogList"
PageSize="12"
runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" />
</Fields>
</asp:DataPager>
</span>
</div>
<br />
<asp:ListView ID="catalogList" runat="server" <asp:ListView ID="catalogList" runat="server"
DataKeyNames="Id" GroupItemCount="3" DataKeyNames="Id" GroupItemCount="3"
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem">
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem" SelectMethod="catalogList_GetData" DeleteMethod="catalogList_DeleteItem">
<EmptyDataTemplate> <EmptyDataTemplate>
<div class="row"> <div class="row">
<span class="col-md-10 col-md-offset-1">There's nothing in the catalog to display at this time. <span class="col-md-10 col-md-offset-1">There's nothing in the catalog to display at this time.
@ -37,21 +18,28 @@
<div id="itemPlaceholderConatiner" class="row"> <div id="itemPlaceholderConatiner" class="row">
<div id="itemPlaceholder" runat="server"></div> <div id="itemPlaceholder" runat="server"></div>
</div> </div>
<br />
<br />
</GroupTemplate> </GroupTemplate>
<ItemTemplate> <ItemTemplate>
<div class="col-md-4"> <div class="col-md-4">
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
<a href="EditCatalogItem.aspx?id=<%#:Item.Id%>">
<img class="esh-catalog-thumbnail" src="<%#:Item.PictureUri%>" <img class="esh-catalog-thumbnail" src="<%#:Item.PictureUri%>"
style="border: solid" /></a>
<br />
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
style="border: solid" />
<br />
<span class="esh-catalog-name"> <span class="esh-catalog-name">
<%#:Item.Name%> <%#:Item.Name%>
</span> </span>
<br />
<span class="esh-catalog-price">
<b>Price: </b><%#:String.Format("{0:c}", Item.Price)%>
</span>
<br />
</a> </a>
<br />
<span class="esh-catalog-price">
<b>Price: </b><%#:String.Format("{0:c}", Item.Price)%>
<span class="esh-catalog-label">
<asp:LinkButton ID="DeleteItem" CommandArgument="<%= Item.Id %>"
runat="server" CommandName="Delete"
Text="Delete">Delete</asp:LinkButton>
</span> </span>
</div> </div>
</ItemTemplate> </ItemTemplate>


+ 15
- 13
src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs View File

@ -1,6 +1,4 @@
using Autofac;
using Autofac.Core;
using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.Services.Catalog; using eShopOnContainers.Core.Services.Catalog;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -10,11 +8,12 @@ using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class _Default : Page public partial class _Default : Page
{ {
private ICatalogService catalog; private ICatalogService catalog;
private CatalogItem itemToEdit;
protected _Default() { } protected _Default() { }
@ -23,23 +22,26 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms
this.catalog = catalog; this.catalog = catalog;
} }
protected override void OnLoad(EventArgs e)
protected void Page_Load(object sender, EventArgs e)
{ {
RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync));
base.OnLoad(e);
} }
private async Task LoadCatalogDataAsync()
// The return type can be changed to IEnumerable, however to support
// paging and sorting, the following parameters must be added:
// int maximumRows
// int startRowIndex
// out int totalRowCount
// string sortByExpression
public async Task<IEnumerable<CatalogItem>> catalogList_GetData()
{ {
var collection = await catalog?.GetCatalogAsync();
catalogList.DataSource = collection;
catalogList.DataBind();
return await catalog?.GetCatalogAsync();
} }
protected void Page_Load(object sender, EventArgs e)
// The id parameter name should match the DataKeyNames value set on the control
public async Task catalogList_DeleteItem(int id)
{ {
//TODO: Call the service.
} }
} }
} }

+ 1
- 10
src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs View File

@ -7,20 +7,11 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
namespace eShopOnContainers.Catalog.WebForms {
public partial class _Default { public partial class _Default {
/// <summary>
/// DataPager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DataPager DataPager1;
/// <summary> /// <summary>
/// catalogList control. /// catalogList control.
/// </summary> /// </summary>


+ 0
- 4
src/Web/Catalog.WebForms/Catalog.WebForms/Dockerfile View File

@ -1,4 +0,0 @@
FROM microsoft/aspnet
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

+ 41
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx View File

@ -0,0 +1,41 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="EditCatalogItem.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.EditCatalogItem" Async="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<asp:FormView ID="EditCatalogItemForm" runat="server" DefaultMode="Edit"
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem"
SelectMethod="EditCatalogItemForm_GetItem"
UpdateMethod="EditCatalogItemForm_UpdateItem"
InsertMethod="EditCatalogItemForm_InsertItem">
<EditItemTemplate>
<section>
<div class="col-md-6">
<form>
<div class="form-group">
<label class="control-label form-label" for="ItemName">Name</label>
<input name="ItemName" class="form-control form-input form-input-center" value="<%#Item.Name%>" />
</div>
<div class="form-group">
<label class="control-label form-label" for="ItemDescription">Description</label>
<input name="ItemDescription" class="form-control form-input form-input-center" value="<%#Item.Description%>" />
</div>
<div class="form-group">
<label class="control-label form-label" for="ItemPrice">Price</label>
<input name="ItemPrice" class="form-control form-input form-input-center" value="<%#Item.Price%>" />
</div>
<div class="form-group">
<label class="control-label form-label" for="ItemBrand">Brand</label>
<asp:DropDownList ID="ItemBrand" runat="server" DataTextField="Brand" />
</div>
<div class="form-group">
<label class="control-label form-label" for="ItemType">Type</label>
<asp:DropDownList ID="ItemType" runat="server" DataTextField="Type" />
</div>
<div class="col-md-6">
This is where the picture to edit goes
</div>
</form>
</div>
</section>
</EditItemTemplate>
</asp:FormView>
</asp:Content>

+ 72
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs View File

@ -0,0 +1,72 @@
using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.Services.Catalog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.ModelBinding;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace eShopOnContainers.Catalog.WebForms
{
public partial class EditCatalogItem : System.Web.UI.Page
{
private ICatalogService catalog;
public IEnumerable<CatalogBrand> Brands;
public IEnumerable<CatalogType> Types;
protected EditCatalogItem() { }
public EditCatalogItem(ICatalogService catalog)
{
this.catalog = catalog;
}
protected void Page_Load(object sender, EventArgs e)
{
}
// The id parameter should match the DataKeyNames value set on the control
// or be decorated with a value provider attribute, e.g. [QueryString]int id
public async Task<CatalogItem> EditCatalogItemForm_GetItem([QueryString]int id)
{
// TODO: If null, go into insert mode.
var itemToEdit = await catalog?.GetCatalogItemAsync(id.ToString());
return itemToEdit;
}
// The id parameter name should match the DataKeyNames value set on the control
public void EditCatalogItemForm_UpdateItem(int id)
{
eShopOnContainers.Core.Models.Catalog.CatalogItem item = null;
// Load the item here, e.g. item = MyDataLayer.Find(id);
if (item == null)
{
// The item wasn't found
ModelState.AddModelError("", String.Format("Item with id {0} was not found", id));
return;
}
TryUpdateModel(item);
if (ModelState.IsValid)
{
// Save changes here, e.g. MyDataLayer.SaveChanges();
}
}
public void EditCatalogItemForm_InsertItem()
{
var item = new eShopOnContainers.Core.Models.Catalog.CatalogItem();
TryUpdateModel(item);
if (ModelState.IsValid)
{
// Save changes here
}
}
}
}

+ 24
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace eShopOnContainers.Catalog.WebForms {
public partial class EditCatalogItem {
/// <summary>
/// EditCatalogItemForm control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FormView EditCatalogItemForm;
}
}

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax View File

@ -1 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.Global" Language="C#" %>
<%@ Application Codebehind="Global.asax.cs" Inherits="eShopOnContainers.Catalog.WebForms.Global" Language="C#" %>

+ 5
- 3
src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs View File

@ -1,19 +1,21 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; using System.Web;
using System.Web.Optimization; using System.Web.Optimization;
using System.Web.Routing; using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public class Global : HttpApplication public class Global : HttpApplication
{ {
void Application_Start(object sender, EventArgs e) void Application_Start(object sender, EventArgs e)
{ {
// Code that runs on application startup // Code that runs on application startup
RouteConfig.RegisterRoutes(RouteTable.Routes); RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles); BundleConfig.RegisterBundles(BundleTable.Bundles);
} }
} }
} }

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs View File

@ -14,4 +14,4 @@ namespace eShopOnContainers.Core.Models.Catalog
public int CatalogTypeId { get; set; } public int CatalogTypeId { get; set; }
public string CatalogType { get; set; } public string CatalogType { get; set; }
} }
}
}

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs View File

@ -9,4 +9,4 @@ namespace eShopOnContainers.Core.Models.Catalog
public int Count { get; set; } public int Count { get; set; }
public List<CatalogItem> Data { get; set; } public List<CatalogItem> Data { get; set; }
} }
}
}

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs View File

@ -9,4 +9,4 @@ namespace eShopOnContainers.Core.Models.Catalog
public override string ToString() => Type; public override string ToString() => Type;
} }
}
}

+ 100
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Models/IdentityModels.cs View File

@ -0,0 +1,100 @@
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using eShopOnContainers.Catalog.WebForms.Models;
namespace eShopOnContainers.Catalog.WebForms.Models
{
// You can add User data for the user by adding more properties to your User class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
public ClaimsIdentity GenerateUserIdentity(ApplicationUserManager manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = manager.CreateIdentity(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
public Task<ClaimsIdentity> GenerateUserIdentityAsync(ApplicationUserManager manager)
{
return Task.FromResult(GenerateUserIdentity(manager));
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
}
#region Helpers
namespace eShopOnContainers.Catalog.WebForms
{
public static class IdentityHelper
{
// Used for XSRF when linking external logins
public const string XsrfKey = "XsrfId";
public const string ProviderNameKey = "providerName";
public static string GetProviderNameFromRequest(HttpRequest request)
{
return request.QueryString[ProviderNameKey];
}
public const string CodeKey = "code";
public static string GetCodeFromRequest(HttpRequest request)
{
return request.QueryString[CodeKey];
}
public const string UserIdKey = "userId";
public static string GetUserIdFromRequest(HttpRequest request)
{
return HttpUtility.UrlDecode(request.QueryString[UserIdKey]);
}
public static string GetResetPasswordRedirectUrl(string code, HttpRequest request)
{
var absoluteUri = "/Account/ResetPassword?" + CodeKey + "=" + HttpUtility.UrlEncode(code);
return new Uri(request.Url, absoluteUri).AbsoluteUri.ToString();
}
public static string GetUserConfirmationRedirectUrl(string code, string userId, HttpRequest request)
{
var absoluteUri = "/Account/Confirm?" + CodeKey + "=" + HttpUtility.UrlEncode(code) + "&" + UserIdKey + "=" + HttpUtility.UrlEncode(userId);
return new Uri(request.Url, absoluteUri).AbsoluteUri.ToString();
}
private static bool IsLocalUrl(string url)
{
return !string.IsNullOrEmpty(url) && ((url[0] == '/' && (url.Length == 1 || (url[1] != '/' && url[1] != '\\'))) || (url.Length > 1 && url[0] == '~' && url[1] == '/'));
}
public static void RedirectToReturnUrl(string returnUrl, HttpResponse response)
{
if (!String.IsNullOrEmpty(returnUrl) && IsLocalUrl(returnUrl))
{
response.Redirect(returnUrl);
}
else
{
response.Redirect("~/");
}
}
}
}
#endregion

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs View File

@ -7,7 +7,7 @@ using System.Web;
using System.Web.Configuration; using System.Web.Configuration;
using System.Web.UI; using System.Web.UI;
namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules
namespace eShopOnContainers.Catalog.WebForms.Modules
{ {
// Using DI with WebForms is not yet implemented. // Using DI with WebForms is not yet implemented.
// This implementation has been adapted from this post: // This implementation has been adapted from this post:


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs View File

@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("07b42e24-32f8-4c10-99a8-0fb5ac6bfebb")]
[assembly: Guid("487a4e92-faa3-415c-a019-6edadb8ab1d9")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //


+ 31
- 26
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master View File

@ -1,4 +1,4 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.SiteMaster" %>
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="eShopOnContainers.Catalog.WebForms.SiteMaster" %>
<!DOCTYPE html> <!DOCTYPE html>
@ -11,8 +11,7 @@
<asp:PlaceHolder runat="server"> <asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %> <%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder> </asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />
<webopt:BundleReference runat="server" Path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="~/Content/catalog.component.css" rel="stylesheet" /> <link href="~/Content/catalog.component.css" rel="stylesheet" />
<link href="~/Content/app.component.css" rel="stylesheet" /> <link href="~/Content/app.component.css" rel="stylesheet" />
@ -40,37 +39,43 @@
</Scripts> </Scripts>
</asp:ScriptManager> </asp:ScriptManager>
<header class="navbar navbar-light navbar-static-top">
<div class="container">
<article class="row">
<header class="navbar navbar-light navbar-static-top">
<div class="container">
<article class="row">
<section class="col-lg-7 col-md-6 col-xs-12">
<a class="navbar-brand" href="Default.aspx">
<img src="/Content/brand.png" />
</a>
</section>
</article>
</div>
</header>
<section class="col-lg-7 col-md-6 col-xs-12">
<a class="navbar-brand" href="Default.aspx">
<img src="/Content/brand.png" />
</a>
</section>
</article>
</div>
</header>
<div class="container body-content"> <div class="container body-content">
<section class="esh-catalog-hero">
<div class="container">
<img class="esh-catalog-title" src="/Content/main_banner_text.png" />
</div>
</section>
<br />
<asp:ContentPlaceHolder ID="MainContent" runat="server"> <asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<hr /> <hr />
<footer class="esh-app-footer">
<div class="container">
<article class="row">
<footer class="esh-app-footer">
<div class="container">
<article class="row">
<section class="col-sm-6">
<img class="esh-app-footer-brand" src="/Content/brand_dark.png" />
</section>
<section class="col-sm-6">
<img class="esh-app-footer-brand" src="/Content/brand_dark.png" />
</section>
<section class="col-sm-6">
<div class="esh-app-footer-text hidden-xs"> e-ShoponContainers. All right reserved </div>
</section>
<section class="col-sm-6">
<div class="esh-app-footer-text hidden-xs">e-ShoponContainers. All right reserved </div>
</section>
</article>
</div>
</footer>
</article>
</div>
</footer>
</div> </div>
</form> </form>


+ 66
- 2
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs View File

@ -1,17 +1,81 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Web; using System.Web;
using System.Web.Security;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class SiteMaster : MasterPage public partial class SiteMaster : MasterPage
{ {
private const string AntiXsrfTokenKey = "__AntiXsrfToken";
private const string AntiXsrfUserNameKey = "__AntiXsrfUserName";
private string _antiXsrfTokenValue;
protected void Page_Init(object sender, EventArgs e)
{
// The code below helps to protect against XSRF attacks
var requestCookie = Request.Cookies[AntiXsrfTokenKey];
Guid requestCookieGuidValue;
if (requestCookie != null && Guid.TryParse(requestCookie.Value, out requestCookieGuidValue))
{
// Use the Anti-XSRF token from the cookie
_antiXsrfTokenValue = requestCookie.Value;
Page.ViewStateUserKey = _antiXsrfTokenValue;
}
else
{
// Generate a new Anti-XSRF token and save to the cookie
_antiXsrfTokenValue = Guid.NewGuid().ToString("N");
Page.ViewStateUserKey = _antiXsrfTokenValue;
var responseCookie = new HttpCookie(AntiXsrfTokenKey)
{
HttpOnly = true,
Value = _antiXsrfTokenValue
};
if (FormsAuthentication.RequireSSL && Request.IsSecureConnection)
{
responseCookie.Secure = true;
}
Response.Cookies.Set(responseCookie);
}
Page.PreLoad += master_Page_PreLoad;
}
protected void master_Page_PreLoad(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Set Anti-XSRF token
ViewState[AntiXsrfTokenKey] = Page.ViewStateUserKey;
ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty;
}
else
{
// Validate the Anti-XSRF token
if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue
|| (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty))
{
throw new InvalidOperationException("Validation of Anti-XSRF token failed.");
}
}
}
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
} }
protected void Unnamed_LoggingOut(object sender, LoginCancelEventArgs e)
{
Context.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
}
} }
} }

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs View File

@ -7,7 +7,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
namespace eShopOnContainers.Catalog.WebForms {
public partial class SiteMaster { public partial class SiteMaster {


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master View File

@ -1,4 +1,4 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.Mobile.master.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.Site_Mobile" %>
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.Mobile.master.cs" Inherits="eShopOnContainers.Catalog.WebForms.Site_Mobile" %>
<%@ Register Src="~/ViewSwitcher.ascx" TagPrefix="friendlyUrls" TagName="ViewSwitcher" %> <%@ Register Src="~/ViewSwitcher.ascx" TagPrefix="friendlyUrls" TagName="ViewSwitcher" %>
<!DOCTYPE html> <!DOCTYPE html>


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs View File

@ -5,7 +5,7 @@ using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class Site_Mobile : System.Web.UI.MasterPage public partial class Site_Mobile : System.Web.UI.MasterPage
{ {


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs View File

@ -7,7 +7,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
namespace eShopOnContainers.Catalog.WebForms {
public partial class Site_Mobile { public partial class Site_Mobile {


+ 12
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs View File

@ -0,0 +1,12 @@
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(eShopOnContainers.Catalog.WebForms.Startup))]
namespace eShopOnContainers.Catalog.WebForms
{
public partial class Startup {
public void Configuration(IAppBuilder app) {
ConfigureAuth(app);
}
}
}

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx View File

@ -1,4 +1,4 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewSwitcher.ascx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms.ViewSwitcher" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewSwitcher.ascx.cs" Inherits="eShopOnContainers.Catalog.WebForms.ViewSwitcher" %>
<div id="viewSwitcher"> <div id="viewSwitcher">
<%: CurrentView %> view | <a href="<%: SwitchUrl %>" data-ajax="false">Switch to <%: AlternateView %></a> <%: CurrentView %> view | <a href="<%: SwitchUrl %>" data-ajax="false">Switch to <%: AlternateView %></a>
</div> </div>

+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs View File

@ -7,7 +7,7 @@ using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using Microsoft.AspNet.FriendlyUrls.Resolvers; using Microsoft.AspNet.FriendlyUrls.Resolvers;
namespace Microsoft.eShopOnContainers.Catalog.WebForms
namespace eShopOnContainers.Catalog.WebForms
{ {
public partial class ViewSwitcher : System.Web.UI.UserControl public partial class ViewSwitcher : System.Web.UI.UserControl
{ {


+ 1
- 1
src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs View File

@ -7,7 +7,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
namespace eShopOnContainers.Catalog.WebForms {
public partial class ViewSwitcher { public partial class ViewSwitcher {


+ 87
- 14
src/Web/Catalog.WebForms/Catalog.WebForms/Web.config View File

@ -4,26 +4,78 @@
https://go.microsoft.com/fwlink/?LinkId=169433 https://go.microsoft.com/fwlink/?LinkId=169433
--> -->
<configuration> <configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings> <appSettings>
<add key="usefake" value="true" /> <add key="usefake" value="true" />
</appSettings> </appSettings>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Catalog.WebForms-20170322110716.mdf;Initial Catalog=aspnet-Catalog.WebForms-20170322110716;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web> <system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<authentication mode="None" />
<compilation debug="true" targetFramework="4.6.2" />
<httpRuntime targetFramework="4.6.2" />
<pages> <pages>
<namespaces> <namespaces>
<add namespace="System.Web.Optimization" /> <add namespace="System.Web.Optimization" />
<add namespace="Microsoft.AspNet.Identity" />
</namespaces> </namespaces>
<controls> <controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /> <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
</controls> </controls>
</pages> </pages>
<membership>
<providers>
<!--
ASP.NET Membership is disabled in this template. Please visit the following link https://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear />
</providers>
</membership>
<profile>
<providers>
<!--
ASP.NET Membership Profile is disabled in this template. Please visit the following link https://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear />
</providers>
</profile>
<roleManager>
<!--
ASP.NET Membership Role is disabled in this template. Please visit the following link https://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<providers>
<clear />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
<httpModules> <httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
<!-- Use this if you are on IIS 7 and earlier -->
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" />
</httpModules> </httpModules>
</system.web> </system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
<!-- Use this if you are on IIS 8 and later -->
<add name="InjectModule" type="eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, eShopOnContainers.Catalog.WebForms"/>
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
@ -33,18 +85,39 @@
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
<!-- Use this if you are on IIS 8 and later -->
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" />
</modules>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.codedom> <system.codedom>
<compilers> <compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />


+ 41
- 26
src/Web/Catalog.WebForms/Catalog.WebForms/packages.config View File

@ -1,29 +1,44 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Antlr" version="3.4.1.9004" targetFramework="net452" />
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" />
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" />
<package id="Autofac" version="4.3.0" targetFramework="net452" />
<package id="bootstrap" version="3.0.0" targetFramework="net452" />
<package id="jQuery" version="1.10.2" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" />
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" />
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" />
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Modernizr" version="2.6.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
<package id="Respond" version="1.2.0" targetFramework="net452" />
<package id="WebGrease" version="1.5.2" targetFramework="net452" />
<package id="Antlr" version="3.4.1.9004" targetFramework="net462" />
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net462" />
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net462" />
<package id="Autofac" version="4.4.0" targetFramework="net462" />
<package id="bootstrap" version="3.0.0" targetFramework="net462" />
<package id="EntityFramework" version="6.1.3" targetFramework="net462" />
<package id="jQuery" version="1.10.2" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net462" />
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net462" />
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net462" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net462" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net462" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net462" />
<package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net462" />
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net462" />
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net462" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net462" />
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net462" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net462" />
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net462" developmentDependency="true" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net462" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net462" />
<package id="Modernizr" version="2.6.2" targetFramework="net462" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net462" />
<package id="Owin" version="1.0" targetFramework="net462" />
<package id="Respond" version="1.2.0" targetFramework="net462" />
<package id="WebGrease" version="1.5.2" targetFramework="net462" />
</packages> </packages>

+ 0
- 1
src/Web/Catalog.WebForms/docker-compose.ci.build.yml View File

@ -1 +0,0 @@
version: '2.1'

+ 0
- 22
src/Web/Catalog.WebForms/docker-compose.dcproj View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>7816bbb6-20b9-4d5a-864d-47b7c6e3d3d5</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>http://{ServiceIPAddress}</DockerServiceUrl>
<DockerServiceName>catalog.webforms</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.ci.build.yml" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.debug.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.release.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
</ItemGroup>
</Project>

+ 0
- 23
src/Web/Catalog.WebForms/docker-compose.override.yml View File

@ -1,23 +0,0 @@
version: '2.1'
services:
sql.data:
environment:
- ACCEPT_EULA=Y
catalog.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
#- ExternalCatalogBaseUrl=http://13.88.8.119:5101 #Remote: VM Needs to have public access at 5105.
- ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
ports:
- "5101:5101"
catalog.webforms:
ports:
- "80"
networks:
default:
external:
name: nat

+ 0
- 28
src/Web/Catalog.WebForms/docker-compose.vs.debug.yml View File

@ -1,28 +0,0 @@
version: '2.1'
services:
catalog.api:
image: eshop/catalog.api:dev
build:
args:
source: ${DOCKER_BUILD_SOURCE}
environment:
- DOTNET_USE_POLLING_FILE_WATCHER=1
volumes:
- ../../Services/Catalog/Catalog.API:/app
- ~/.nuget/packages:/root/.nuget/packages:ro
- ~/clrdbg:/clrdbg:ro
entrypoint: tail -f /dev/null
labels:
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
catalog.webforms:
image: catalog.webforms:dev
build:
args:
source: ${DOCKER_BUILD_SOURCE}
volumes:
- .\Catalog.WebForms:C:\inetpub\wwwroot
- ~\msvsmon:C:\msvsmon:ro
labels:
- "com.microsoft.visualstudio.targetoperatingsystem=windows"

+ 0
- 21
src/Web/Catalog.WebForms/docker-compose.vs.release.yml View File

@ -1,21 +0,0 @@
version: '2.1'
services:
catalog.api:
build:
args:
source: ${DOCKER_BUILD_SOURCE}
volumes:
- ~/clrdbg:/clrdbg:ro
entrypoint: tail -f /dev/null
labels:
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
catalog.webforms:
build:
args:
source: ${DOCKER_BUILD_SOURCE}
volumes:
- ~\msvsmon:C:\msvsmon:ro
labels:
- "com.microsoft.visualstudio.targetoperatingsystem=windows"

+ 0
- 22
src/Web/Catalog.WebForms/docker-compose.yml View File

@ -1,22 +0,0 @@
version: '2.1'
services:
catalog.webforms:
image: catalog.webforms
build:
context: .\Catalog.WebForms
dockerfile: Dockerfile
depends_on:
- catalog.api
catalog.api:
image: eshop/catalog.api
build:
context: ../../Services/Catalog/Catalog.API
dockerfile: Dockerfile.nanowin
depends_on:
- sql.data
sql.data:
image: microsoft/mssql-server-windows

Loading…
Cancel
Save