Merge pull request #136 from BillWagner/implement-CRUD-on-webforms-app
Implement crud on webforms app
This commit is contained in:
commit
39aec4cb8a
6
src/Services/Catalog/Catalog.API/Dockerfile.windows
Normal file
6
src/Services/Catalog/Catalog.API/Dockerfile.windows
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM microsoft/aspnet
|
||||||
|
ARG source
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 80
|
||||||
|
COPY ${source:-obj/Docker/publish} .
|
||||||
|
ENTRYPOINT ["dotnet", "Catalog.API.dll"]
|
@ -1,17 +1,13 @@
|
|||||||
|
|
||||||
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}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catalog.WebForms", "Catalog.WebForms\Catalog.WebForms.csproj", "{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catalog.API", "..\..\Services\Catalog\Catalog.API\Catalog.API.csproj", "{3D130B2D-632C-4839-8CF7-F2F70EA43306}"
|
||||||
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
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catalog.API", "..\..\Services\Catalog\Catalog.API\Catalog.API.csproj", "{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}"
|
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{E562EED3-9F2F-459B-83AE-C6F15706B7AD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -19,18 +15,18 @@ 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
|
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{3D130B2D-632C-4839-8CF7-F2F70EA43306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3D130B2D-632C-4839-8CF7-F2F70EA43306}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3D130B2D-632C-4839-8CF7-F2F70EA43306}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3D130B2D-632C-4839-8CF7-F2F70EA43306}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{E562EED3-9F2F-459B-83AE-C6F15706B7AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E562EED3-9F2F-459B-83AE-C6F15706B7AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E562EED3-9F2F-459B-83AE-C6F15706B7AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E562EED3-9F2F-459B-83AE-C6F15706B7AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -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>
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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 {
|
namespace eShopOnContainers.Catalog.WebForms
|
||||||
|
{
|
||||||
|
|
||||||
public partial class About {
|
|
||||||
|
public partial class About
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs
generated
Normal file
33
src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs
generated
Normal file
43
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs
generated
Normal 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs
generated
Normal file
60
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs
generated
Normal file
17
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs
generated
Normal 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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx
Normal file
65
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx
Normal 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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs
generated
Normal file
78
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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]" /> |
|
||||||
|
<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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs
Normal file
128
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs
Normal 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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs
generated
Normal file
42
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs
generated
Normal file
24
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs
generated
Normal file
105
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs
generated
Normal file
24
src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs
generated
Normal file
51
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs
generated
Normal file
24
src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs
generated
Normal file
51
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -0,0 +1,8 @@
|
|||||||
|
using System.Web.UI;
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Catalog.WebForms.Account
|
||||||
|
{
|
||||||
|
public partial class ResetPasswordConfirmation : Page
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
24
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs
generated
Normal file
24
src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs
generated
Normal file
105
src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs
generated
Normal file
42
src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs
generated
Normal 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
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config
Normal file
12
src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<location path="Manage.aspx">
|
||||||
|
<system.web>
|
||||||
|
<authorization>
|
||||||
|
<deny users="?"/>
|
||||||
|
</authorization>
|
||||||
|
</system.web>
|
||||||
|
</location>
|
||||||
|
|
||||||
|
</configuration>
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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 = ""
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
<RootNamespace>eShopOnContainers.Catalog.WebForms</RootNamespace>
|
||||||
<AssemblyName>Catalog.WebForms</AssemblyName>
|
<AssemblyName>eShopOnContainers.Catalog.WebForms</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<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">
|
<Reference Include="Autofac, Version=4.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Autofac.4.3.0\lib\net45\Autofac.dll</HintPath>
|
<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>
|
||||||
@ -56,6 +56,7 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Data.Entity" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
@ -106,6 +107,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,22 +179,45 @@
|
|||||||
</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\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\catalog.component.css" />
|
||||||
<Content Include="Content\fake_product_01.png" />
|
<Content Include="Content\fake_product_01.png" />
|
||||||
<Content Include="Content\fake_product_02.png" />
|
<Content Include="Content\fake_product_02.png" />
|
||||||
<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>
|
||||||
@ -190,6 +262,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>
|
||||||
@ -198,7 +375,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>
|
||||||
@ -213,6 +392,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>
|
||||||
@ -221,6 +407,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" />
|
||||||
@ -242,6 +429,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>
|
||||||
@ -276,7 +464,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,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>
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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 {
|
namespace eShopOnContainers.Catalog.WebForms
|
||||||
|
{
|
||||||
|
|
||||||
public partial class Contact {
|
|
||||||
|
public partial class Contact
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,27 @@ body {
|
|||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set widths on the form inputs since otherwise they're 100% wide */
|
/* Override the default bootstrap behavior where horizontal description lists
|
||||||
input,
|
will truncate terms that are too long to fit in the left column
|
||||||
select,
|
*/
|
||||||
textarea {
|
.dl-horizontal dt {
|
||||||
max-width: 280px;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||||
|
input[type="text"],
|
||||||
|
input[type="password"],
|
||||||
|
input[type="email"],
|
||||||
|
input[type="tel"],
|
||||||
|
input[type="select"] {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
.esh-app-footer {
|
||||||
|
background-color: #000000;
|
||||||
|
border-top: 1px solid #EEEEEE;
|
||||||
|
margin-top: 2.5rem;
|
||||||
|
padding-bottom: 2.5rem;
|
||||||
|
padding-top: 2.5rem;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-app-footer-brand {
|
||||||
|
height: 50px;
|
||||||
|
width: 230px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-app-footer-text {
|
||||||
|
color: #83D01B;
|
||||||
|
line-height: 50px;
|
||||||
|
text-align: right;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-full-width {
|
||||||
|
width: 100%;
|
||||||
|
}
|
BIN
src/Web/Catalog.WebForms/Catalog.WebForms/Content/brand.png
Normal file
BIN
src/Web/Catalog.WebForms/Catalog.WebForms/Content/brand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
src/Web/Catalog.WebForms/Catalog.WebForms/Content/brand_dark.png
Normal file
BIN
src/Web/Catalog.WebForms/Catalog.WebForms/Content/brand_dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -0,0 +1,156 @@
|
|||||||
|
.esh-catalog-hero {
|
||||||
|
background-image: url("../Content/main_banner.png");
|
||||||
|
background-size: cover;
|
||||||
|
height: 260px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-title {
|
||||||
|
position: relative;
|
||||||
|
top: 74.28571px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.esh-catalog-filters {
|
||||||
|
background-color: #00A69C;
|
||||||
|
height: 65px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-filter {
|
||||||
|
background-color: transparent;
|
||||||
|
border-color: #00d9cc;
|
||||||
|
color: #FFFFFF;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 1rem;
|
||||||
|
margin-top: .5rem;
|
||||||
|
outline-color: #83D01B;
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
min-width: 140px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-filter option {
|
||||||
|
background-color: #00A69C;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
.esh-catalog-label {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-label::before {
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
content: attr(data-title);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
margin-top: 0.65rem;
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
position: absolute;
|
||||||
|
text-transform: uppercase;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-label::after {
|
||||||
|
background-image: url("../../images/arrow-down.png");
|
||||||
|
height: 7px;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 1.5rem;
|
||||||
|
top: 2.5rem;
|
||||||
|
width: 10px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.esh-catalog-send {
|
||||||
|
background-color: #83D01B;
|
||||||
|
color: #FFFFFF;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
transform: translateY(.5rem);
|
||||||
|
padding: 0.5rem;
|
||||||
|
transition: all 0.35s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-send:hover {
|
||||||
|
background-color: #4a760f;
|
||||||
|
transition: all 0.35s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-items {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-item {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
width: 33%;
|
||||||
|
display: inline-block;
|
||||||
|
float: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1024px) {
|
||||||
|
.esh-catalog-item {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.esh-catalog-item {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.esh-catalog-thumbnail {
|
||||||
|
max-width: 370px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.esh-catalog-button {
|
||||||
|
background-color: #83D01B;
|
||||||
|
border: none;
|
||||||
|
color: #FFFFFF;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
height: 3rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
transition: all 0.35s;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-button.is-disabled {
|
||||||
|
opacity: .5;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-button:hover {
|
||||||
|
background-color: #4a760f;
|
||||||
|
transition: all 0.35s;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
.esh-catalog-name {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 300;
|
||||||
|
margin-top: .5rem;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.esh-catalog-price {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.esh-catalog-price::before {
|
||||||
|
content: '$';
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
Binary file not shown.
After Width: | Height: | Size: 713 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
@ -1,73 +1,56 @@
|
|||||||
<%@ 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">
|
||||||
|
<asp:ListView ID="catalogList" runat="server"
|
||||||
|
DataKeyNames="Id" GroupItemCount="3"
|
||||||
|
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem"
|
||||||
|
SelectMethod="GetCatalogDataAsync"
|
||||||
|
DeleteMethod="DeleteCatalogItemAsync">
|
||||||
|
<EmptyDataTemplate>
|
||||||
|
<div class="row">
|
||||||
|
<span class="col-md-10 col-md-offset-1">There's nothing in the catalog to display at this time.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</EmptyDataTemplate>
|
||||||
|
<LayoutTemplate>
|
||||||
|
<div id="groupPlaceholder" runat="server"></div>
|
||||||
|
</LayoutTemplate>
|
||||||
|
<GroupTemplate>
|
||||||
|
<div id="itemPlaceholderConatiner" class="row">
|
||||||
|
<div id="itemPlaceholder" runat="server"></div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
</GroupTemplate>
|
||||||
|
<ItemTemplate>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<a href="EditCatalogItem.aspx?id=<%#:Item.Id%>">
|
||||||
|
<img class="esh-catalog-thumbnail" src="<%#:Item.PictureUri%>"
|
||||||
|
style="border: solid" />
|
||||||
|
<br />
|
||||||
|
<span class="esh-catalog-name">
|
||||||
|
<%#:Item.Name%>
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
<span class="esh-catalog-price">
|
||||||
|
<b>Price: </b><%#:String.Format("{0:c}", Item.Price)%>
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
</a>
|
||||||
|
<span class="esh-catalog-label">
|
||||||
|
<asp:LinkButton ID="DeleteItem" CommandArgument="<%= Item.Id %>"
|
||||||
|
runat="server" CommandName="Delete"
|
||||||
|
Text="Delete">Delete</asp:LinkButton>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:ListView>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<asp:ListView ID="catalogList" runat="server"
|
<span class="esh-catalog-label col-md-4 col-md-offset-2l">
|
||||||
DataKeyNames="Id" GroupItemCount="4"
|
<a href="EditCatalogItem.aspx">
|
||||||
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem">
|
Insert item
|
||||||
<EmptyDataTemplate>
|
</a>
|
||||||
<table >
|
</span>
|
||||||
<tr>
|
|
||||||
<td>Well, there's nothing in the catalog.</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</EmptyDataTemplate>
|
|
||||||
<EmptyItemTemplate>
|
|
||||||
<td/>
|
|
||||||
</EmptyItemTemplate>
|
|
||||||
<GroupTemplate>
|
|
||||||
<tr id="itemPlaceholderContainer" runat="server">
|
|
||||||
<td id="itemPlaceholder" runat="server"></td>
|
|
||||||
</tr>
|
|
||||||
</GroupTemplate>
|
|
||||||
<ItemTemplate>
|
|
||||||
<td runat="server">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
|
|
||||||
<img src="<%#:Item.PictureUri%>"
|
|
||||||
style="border: solid" /></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
|
|
||||||
<span>
|
|
||||||
<%#:Item.Name%>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
<br />
|
|
||||||
<span>
|
|
||||||
<b>Price: </b><%#:String.Format("{0:c}", Item.Price)%>
|
|
||||||
</span>
|
|
||||||
<br />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</ItemTemplate>
|
|
||||||
<LayoutTemplate>
|
|
||||||
<table style="width:100%;">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table id="groupPlaceholderContainer" runat="server" style="width:100%">
|
|
||||||
<tr id="groupPlaceholder"></tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</LayoutTemplate>
|
|
||||||
</asp:ListView>
|
|
||||||
</div>
|
</div>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using Autofac;
|
using eShopOnContainers.Core.Models.Catalog;
|
||||||
using Autofac.Core;
|
|
||||||
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,7 +8,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 _Default : Page
|
public partial class _Default : Page
|
||||||
{
|
{
|
||||||
@ -18,28 +16,26 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms
|
|||||||
|
|
||||||
protected _Default() { }
|
protected _Default() { }
|
||||||
|
|
||||||
public _Default(ICatalogService catalog)
|
public _Default(ICatalogService catalog) =>
|
||||||
{
|
|
||||||
this.catalog = catalog;
|
this.catalog = catalog;
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
|
||||||
{
|
|
||||||
RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync));
|
|
||||||
|
|
||||||
base.OnLoad(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadCatalogDataAsync()
|
|
||||||
{
|
|
||||||
var collection = await catalog?.GetCatalogAsync();
|
|
||||||
catalogList.DataSource = collection;
|
|
||||||
catalogList.DataBind();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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>> GetCatalogDataAsync() =>
|
||||||
|
(await catalog?.GetCatalogAsync()).AsEnumerable();
|
||||||
|
|
||||||
|
public Task DeleteCatalogItemAsync(int id)
|
||||||
|
{
|
||||||
|
return catalog?.DeleteCatalogItemAsync(id.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Catalog.WebForms {
|
namespace eShopOnContainers.Catalog.WebForms {
|
||||||
|
|
||||||
|
|
||||||
public partial class _Default {
|
public partial class _Default {
|
||||||
|
129
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx
Normal file
129
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<%@ 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" DataKeyNames="Id"
|
||||||
|
SelectMethod="GetCatalogItemAsync"
|
||||||
|
UpdateMethod="UpdateCatalogItemAsync"
|
||||||
|
InsertMethod="InsertCatalogItemAsync"
|
||||||
|
CssClass="table-compact table-full-width">
|
||||||
|
<EditItemTemplate>
|
||||||
|
<div class="row form-inline">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<img class="esh-catalog-thumbnail" src="<%#:Item.PictureUri%>"
|
||||||
|
style="border: solid" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label>Name</label>
|
||||||
|
<asp:TextBox runat="server" ID="itemName" CssClass="form-control form-input form-input-center" Text='<%# Bind("Name")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label for="ItemDescription">Description</label>
|
||||||
|
<asp:TextBox runat="server" Width="100%" ID="ItemDescription" CssClass="form-control form-input form-input-center" Text='<%# Bind("Description")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label for="ItemPrice">Price</label>
|
||||||
|
<asp:TextBox runat="server" TextMode="Number" Width="75%" ID="ItemPrice" CssClass="form-control form-input form-input-center" Text='<%# Bind("Price")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label class="control-label form-label" for="ItemBrand">Brand</label>
|
||||||
|
<asp:DropDownList ID="ItemBrand" runat="server"
|
||||||
|
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogBrand"
|
||||||
|
SelectMethod="GetBrandsAsync"
|
||||||
|
DataTextField="Brand"
|
||||||
|
DataValueField="Id"
|
||||||
|
SelectedValue="<%# BindItem.CatalogBrandId %>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label class="control-label form-label" for="ItemType">Type</label>
|
||||||
|
<asp:DropDownList ID="ItemType" runat="server"
|
||||||
|
SelectMethod="GetTypesAsync"
|
||||||
|
DataTextField="Type"
|
||||||
|
DataValueField="Id"
|
||||||
|
SelectedValue="<%# BindItem.CatalogTypeId %>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 form-group">
|
||||||
|
<asp:LinkButton runat="server" Text="Update" CommandName="Update" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 form-group">
|
||||||
|
<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</EditItemTemplate>
|
||||||
|
<InsertItemTemplate>
|
||||||
|
<div class="row form-inline">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<asp:FileUpload CssClass="esh-catalog-thumbnail" runat="server" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label>Name</label>
|
||||||
|
<asp:TextBox runat="server" ID="itemName" CssClass="form-control form-input form-input-center" Text='<%# Bind("Name")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label for="ItemDescription">Description</label>
|
||||||
|
<asp:TextBox runat="server" Width="100%" ID="ItemDescription" CssClass="form-control form-input form-input-center" Text='<%# Bind("Description")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label for="ItemPrice">Price</label>
|
||||||
|
<asp:TextBox runat="server" TextMode="Number" Width="75%" ID="ItemPrice" CssClass="form-control form-input form-input-center" Text='<%# Bind("Price")%>' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label class="control-label form-label" for="ItemBrand">Brand</label>
|
||||||
|
<asp:DropDownList ID="ItemBrand" runat="server"
|
||||||
|
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogBrand"
|
||||||
|
SelectMethod="GetBrandsAsync"
|
||||||
|
DataTextField="Brand"
|
||||||
|
DataValueField="Id"
|
||||||
|
SelectedValue="<%# BindItem.CatalogBrandId %>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 form-group">
|
||||||
|
<label class="control-label form-label" for="ItemType">Type</label>
|
||||||
|
<asp:DropDownList ID="ItemType" runat="server"
|
||||||
|
SelectMethod="GetTypesAsync"
|
||||||
|
DataTextField="Type"
|
||||||
|
DataValueField="Id"
|
||||||
|
SelectedValue="<%# BindItem.CatalogTypeId %>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 form-group">
|
||||||
|
<asp:LinkButton runat="server" Text="Add" CommandName="Insert" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 form-group">
|
||||||
|
<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</InsertItemTemplate>
|
||||||
|
</asp:FormView>
|
||||||
|
</asp:Content>
|
@ -0,0 +1,90 @@
|
|||||||
|
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> GetCatalogItemAsync([QueryString]int? id)
|
||||||
|
{
|
||||||
|
if (id.HasValue)
|
||||||
|
{
|
||||||
|
var itemToEdit = await catalog?.GetCatalogItemAsync(id.ToString());
|
||||||
|
return itemToEdit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditCatalogItemForm.ChangeMode(FormViewMode.Insert);
|
||||||
|
return new CatalogItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The id parameter name should match the DataKeyNames value set on the control
|
||||||
|
public async Task UpdateCatalogItemAsync(int id)
|
||||||
|
{
|
||||||
|
CatalogItem item = await catalog?.GetCatalogItemAsync(id.ToString());
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
// The item wasn't found
|
||||||
|
ModelState.AddModelError("", String.Format("Item with id {0} was not found", id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (TryUpdateModel(item) && (ModelState.IsValid))
|
||||||
|
{
|
||||||
|
await catalog?.UpdateCatalogItemAsync(item);
|
||||||
|
Response.Redirect("~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task InsertCatalogItemAsync()
|
||||||
|
{
|
||||||
|
var item = new eShopOnContainers.Core.Models.Catalog.CatalogItem();
|
||||||
|
TryUpdateModel(item);
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
// Save changes here
|
||||||
|
await catalog?.CreateCatalogItemAsync(item);
|
||||||
|
Response.Redirect("~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<CatalogBrand>> GetBrandsAsync()
|
||||||
|
{
|
||||||
|
var brands = await catalog?.GetCatalogBrandAsync();
|
||||||
|
return brands.AsEnumerable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<CatalogType>> GetTypesAsync()
|
||||||
|
{
|
||||||
|
var types = await catalog?.GetCatalogTypeAsync();
|
||||||
|
return types.AsEnumerable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs
generated
Normal file
24
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs
generated
Normal 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 @@
|
|||||||
<%@ 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#" %>
|
||||||
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,4 +9,4 @@ namespace eShopOnContainers.Core.Models.Catalog
|
|||||||
|
|
||||||
public override string ToString() => Type;
|
public override string ToString() => Type;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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
|
@ -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:
|
||||||
@ -15,9 +15,9 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules
|
|||||||
|
|
||||||
public class AutoFacHttpModule : IHttpModule
|
public class AutoFacHttpModule : IHttpModule
|
||||||
{
|
{
|
||||||
private static IContainer Container => lazyContainer.Value;
|
private IContainer Container => lazyContainer.Value;
|
||||||
|
|
||||||
private static Lazy<IContainer> lazyContainer = new Lazy<IContainer>(() => CreateContainer());
|
private Lazy<IContainer> lazyContainer = new Lazy<IContainer>(() => CreateContainer());
|
||||||
|
|
||||||
private static IContainer CreateContainer()
|
private static IContainer CreateContainer()
|
||||||
{
|
{
|
||||||
@ -44,6 +44,7 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Container.Dispose();
|
Container.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(HttpApplication context)
|
public void Init(HttpApplication context)
|
||||||
|
@ -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:
|
||||||
//
|
//
|
||||||
|
@ -13,19 +13,21 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
// Note: Device specific conditionals have been removed.
|
// Note: Device specific conditionals have been removed.
|
||||||
public class CatalogMockService : ICatalogService
|
public class CatalogMockService : ICatalogService
|
||||||
{
|
{
|
||||||
private ObservableCollection<CatalogBrand> MockCatalogBrand = new ObservableCollection<CatalogBrand>
|
// Change to static so these remain
|
||||||
|
// in scope between requests:
|
||||||
|
private static ObservableCollection<CatalogBrand> MockCatalogBrand = new ObservableCollection<CatalogBrand>
|
||||||
{
|
{
|
||||||
new CatalogBrand { Id = 1, Brand = "Azure" },
|
new CatalogBrand { Id = 1, Brand = "Azure" },
|
||||||
new CatalogBrand { Id = 2, Brand = "Visual Studio" }
|
new CatalogBrand { Id = 2, Brand = "Visual Studio" }
|
||||||
};
|
};
|
||||||
|
|
||||||
private ObservableCollection<CatalogType> MockCatalogType = new ObservableCollection<CatalogType>
|
private static ObservableCollection<CatalogType> MockCatalogType = new ObservableCollection<CatalogType>
|
||||||
{
|
{
|
||||||
new CatalogType { Id = 1, Type = "Mug" },
|
new CatalogType { Id = 1, Type = "Mug" },
|
||||||
new CatalogType { Id = 2, Type = "T-Shirt" }
|
new CatalogType { Id = 2, Type = "T-Shirt" }
|
||||||
};
|
};
|
||||||
|
|
||||||
private ObservableCollection<CatalogItem> MockCatalog = new ObservableCollection<CatalogItem>
|
private static ObservableCollection<CatalogItem> MockCatalog = new ObservableCollection<CatalogItem>
|
||||||
{
|
{
|
||||||
new CatalogItem { Id = Common.Common.MockCatalogItemId01, PictureUri = "Content/fake_product_01.png", Name = ".NET Bot Blue Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
|
new CatalogItem { Id = Common.Common.MockCatalogItemId01, PictureUri = "Content/fake_product_01.png", Name = ".NET Bot Blue Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
|
||||||
new CatalogItem { Id = Common.Common.MockCatalogItemId02, PictureUri = "Content/fake_product_02.png", Name = ".NET Bot Purple Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
|
new CatalogItem { Id = Common.Common.MockCatalogItemId02, PictureUri = "Content/fake_product_02.png", Name = ".NET Bot Purple Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
|
||||||
@ -38,7 +40,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
|
|
||||||
return MockCatalog;
|
// copy so that edits must be changed here to take affect:
|
||||||
|
return new ObservableCollection<CatalogItem>(MockCatalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
|
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
|
||||||
@ -71,5 +74,43 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
return MockCatalog.FirstOrDefault(c => c.Id == id);
|
return MockCatalog.FirstOrDefault(c => c.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeleteCatalogItemAsync(string catalogItemId)
|
||||||
|
{
|
||||||
|
var itemToRemove = MockCatalog.FirstOrDefault(c => c.Id == catalogItemId);
|
||||||
|
await Task.Delay(500);
|
||||||
|
if (itemToRemove != null)
|
||||||
|
MockCatalog.Remove(itemToRemove);
|
||||||
|
else
|
||||||
|
throw new ArgumentException(message: "item could not be found", paramName: nameof(catalogItemId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CatalogItem> UpdateCatalogItemAsync(CatalogItem item)
|
||||||
|
{
|
||||||
|
var itemToChange = MockCatalog.FirstOrDefault(c => item.Id == c.Id);
|
||||||
|
await Task.Delay(500);
|
||||||
|
if (itemToChange != null)
|
||||||
|
{
|
||||||
|
itemToChange.CatalogBrandId = item.CatalogBrandId;
|
||||||
|
itemToChange.CatalogTypeId = item.CatalogTypeId;
|
||||||
|
itemToChange.Description = item.Description;
|
||||||
|
itemToChange.Name = item.Name;
|
||||||
|
itemToChange.Price = item.Price;
|
||||||
|
}
|
||||||
|
return itemToChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CatalogItem> CreateCatalogItemAsync(CatalogItem item)
|
||||||
|
{
|
||||||
|
// set the Id
|
||||||
|
var nextId = MockCatalog.Max(c => int.Parse(c.Id)) + 1;
|
||||||
|
item.Id = nextId.ToString();
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
|
// add.
|
||||||
|
MockCatalog.Add(item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -127,5 +127,42 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return new ObservableCollection<CatalogType>();
|
return new ObservableCollection<CatalogType>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task DeleteCatalogItemAsync(string catalogItemId)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
|
builder.Path = $"api/v1/catalog/{catalogItemId}";
|
||||||
|
|
||||||
|
string uri = builder.ToString();
|
||||||
|
|
||||||
|
return _requestProvider.DeleteAsync(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<CatalogItem> UpdateCatalogItemAsync(CatalogItem item)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
|
builder.Path = "api/v1/catalog/edit";
|
||||||
|
|
||||||
|
string uri = builder.ToString();
|
||||||
|
|
||||||
|
return _requestProvider.PostAsync(uri, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<CatalogItem> CreateCatalogItemAsync(CatalogItem item)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
|
builder.Path = "api/v1/catalog/create";
|
||||||
|
|
||||||
|
string uri = builder.ToString();
|
||||||
|
|
||||||
|
return _requestProvider.PostAsync(uri, item);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync();
|
Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync();
|
||||||
Task<ObservableCollection<CatalogItem>> GetCatalogAsync();
|
Task<ObservableCollection<CatalogItem>> GetCatalogAsync();
|
||||||
Task<CatalogItem> GetCatalogItemAsync(string id);
|
Task<CatalogItem> GetCatalogItemAsync(string id);
|
||||||
|
Task DeleteCatalogItemAsync(string catalogItemId);
|
||||||
|
Task<CatalogItem> UpdateCatalogItemAsync(CatalogItem item);
|
||||||
|
Task<CatalogItem> CreateCatalogItemAsync(CatalogItem item);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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,10 +11,10 @@
|
|||||||
<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/app.component.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form runat="server">
|
<form runat="server">
|
||||||
@ -39,31 +39,42 @@
|
|||||||
</Scripts>
|
</Scripts>
|
||||||
</asp:ScriptManager>
|
</asp:ScriptManager>
|
||||||
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<header class="navbar navbar-light navbar-static-top">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<article class="row">
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
|
||||||
<span class="icon-bar"></span>
|
<section class="col-lg-7 col-md-6 col-xs-12">
|
||||||
<span class="icon-bar"></span>
|
<a class="navbar-brand" href="Default.aspx">
|
||||||
<span class="icon-bar"></span>
|
<img src="/Content/brand.png" />
|
||||||
</button>
|
</a>
|
||||||
<a class="navbar-brand" runat="server" href="~/">Application name</a>
|
</section>
|
||||||
</div>
|
</article>
|
||||||
<div class="navbar-collapse collapse">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a runat="server" href="~/">Home</a></li>
|
|
||||||
<li><a runat="server" href="~/About">About</a></li>
|
|
||||||
<li><a runat="server" href="~/Contact">Contact</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<footer class="esh-app-footer">
|
||||||
<p>© <%: DateTime.Now.Year %> - My ASP.NET Application</p>
|
<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">
|
||||||
|
<div class="esh-app-footer-text hidden-xs">e-ShoponContainers. All right reserved </div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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,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>
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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
src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs
Normal file
12
src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs
Normal 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,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>
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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 {
|
||||||
|
@ -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" />
|
<authentication mode="None" />
|
||||||
<httpRuntime targetFramework="4.5.2" />
|
<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>
|
<entityFramework>
|
||||||
<validation validateIntegratedModeConfiguration="false" />
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
<modules>
|
<parameters>
|
||||||
<remove name="ApplicationInsightsWebTracking" />
|
<parameter value="mssqllocaldb" />
|
||||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
|
</parameters>
|
||||||
<!-- Use this if you are on IIS 8 and later -->
|
</defaultConnectionFactory>
|
||||||
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" />
|
<providers>
|
||||||
</modules>
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
</system.webServer>
|
</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" />
|
||||||
|
@ -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="Antlr" version="3.4.1.9004" targetFramework="net462" />
|
||||||
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" />
|
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net462" />
|
||||||
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" />
|
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net462" />
|
||||||
<package id="Autofac" version="4.3.0" targetFramework="net452" />
|
<package id="Autofac" version="4.4.0" targetFramework="net462" />
|
||||||
<package id="bootstrap" version="3.0.0" targetFramework="net452" />
|
<package id="bootstrap" version="3.0.0" targetFramework="net462" />
|
||||||
<package id="jQuery" version="1.10.2" targetFramework="net452" />
|
<package id="EntityFramework" version="6.1.3" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" />
|
<package id="jQuery" version="1.10.2" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" />
|
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" />
|
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net462" />
|
||||||
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net462" />
|
||||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" />
|
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net462" />
|
||||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net462" />
|
||||||
<package id="Modernizr" version="2.6.2" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net462" />
|
||||||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net462" />
|
||||||
<package id="Respond" version="1.2.0" targetFramework="net452" />
|
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net462" />
|
||||||
<package id="WebGrease" version="1.5.2" targetFramework="net452" />
|
<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>
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>7816bbb6-20b9-4d5a-864d-47b7c6e3d3d5</ProjectGuid>
|
<ProjectGuid>e562eed3-9f2f-459b-83ae-c6f15706b7ad</ProjectGuid>
|
||||||
<DockerLaunchBrowser>True</DockerLaunchBrowser>
|
<DockerLaunchBrowser>True</DockerLaunchBrowser>
|
||||||
<DockerServiceUrl>http://{ServiceIPAddress}</DockerServiceUrl>
|
<DockerServiceUrl>http://{ServiceIPAddress}</DockerServiceUrl>
|
||||||
<DockerServiceName>catalog.webforms</DockerServiceName>
|
<DockerServiceName>catalog.webforms</DockerServiceName>
|
||||||
|
@ -3,7 +3,10 @@ version: '2.1'
|
|||||||
services:
|
services:
|
||||||
sql.data:
|
sql.data:
|
||||||
environment:
|
environment:
|
||||||
|
- SA_PASSWORD=Pass@word
|
||||||
- ACCEPT_EULA=Y
|
- ACCEPT_EULA=Y
|
||||||
|
ports:
|
||||||
|
- "5433:1433"
|
||||||
|
|
||||||
catalog.api:
|
catalog.api:
|
||||||
environment:
|
environment:
|
||||||
@ -16,7 +19,8 @@ services:
|
|||||||
|
|
||||||
catalog.webforms:
|
catalog.webforms:
|
||||||
ports:
|
ports:
|
||||||
- "80"
|
- "80:80"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
external:
|
external:
|
||||||
|
@ -1,21 +1,6 @@
|
|||||||
version: '2.1'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
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:
|
catalog.webforms:
|
||||||
image: catalog.webforms:dev
|
image: catalog.webforms:dev
|
||||||
build:
|
build:
|
||||||
|
@ -1,16 +1,6 @@
|
|||||||
version: '2.1'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
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:
|
catalog.webforms:
|
||||||
build:
|
build:
|
||||||
args:
|
args:
|
||||||
|
@ -12,11 +12,10 @@ services:
|
|||||||
catalog.api:
|
catalog.api:
|
||||||
image: eshop/catalog.api
|
image: eshop/catalog.api
|
||||||
build:
|
build:
|
||||||
context: ../../Services/Catalog/Catalog.API
|
context: ..\..\Services\Catalog\Catalog.API
|
||||||
dockerfile: Dockerfile.nanowin
|
dockerfile: Dockerfile.windows
|
||||||
depends_on:
|
depends_on:
|
||||||
- sql.data
|
- sql.data
|
||||||
|
|
||||||
sql.data:
|
sql.data:
|
||||||
image: microsoft/mssql-server-windows
|
image: microsoft/mssql-server-windows
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user