diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms.sln b/src/Web/Catalog.WebForms/Catalog.WebForms.sln index 9b190779f..318e6f164 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms.sln +++ b/src/Web/Catalog.WebForms/Catalog.WebForms.sln @@ -1,17 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.0 +VisualStudioVersion = 15.0.26228.9 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catalog.WebForms", "Catalog.WebForms\Catalog.WebForms.csproj", "{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}" -EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}" - ProjectSection(ProjectDependencies) = postProject - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB} = {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB} - {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD} = {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD} - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catalog.API", "..\..\Services\Catalog\Catalog.API\Catalog.API.csproj", "{9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catalog.WebForms", "Catalog.WebForms\Catalog.WebForms.csproj", "{487A4E92-FAA3-415C-A019-6EDADB8AB1D9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,18 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}.Release|Any CPU.Build.0 = Release|Any CPU - {7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7816BBB6-20B9-4D5A-864D-47B7C6E3D3D5}.Release|Any CPU.Build.0 = Release|Any CPU - {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B92B9F2-0DB5-4294-8DBF-DE2F87AEADDD}.Release|Any CPU.Build.0 = Release|Any CPU + {487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {487A4E92-FAA3-415C-A019-6EDADB8AB1D9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/.dockerignore b/src/Web/Catalog.WebForms/Catalog.WebForms/.dockerignore deleted file mode 100644 index 7e297f6d2..000000000 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj\Docker\publish\* -!obj\Docker\empty\ diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx index 9b70f79bd..f7e8f30ec 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx @@ -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" %>

<%: Title %>.

diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs index cb479eb14..2d302a80c 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.cs @@ -5,7 +5,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public partial class About : Page { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs index df85a4b19..62aa14b29 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/About.aspx.designer.cs @@ -3,13 +3,15 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { - - - public partial class About { +namespace eShopOnContainers.Catalog.WebForms +{ + + + public partial class About + { } } diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx new file mode 100644 index 000000000..d6e744c79 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+

Add a phone number

+
+ +

+ +

+
+ Phone Number +
+ + +
+
+
+
+ +
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.cs new file mode 100644 index 000000000..763c32b70 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.cs @@ -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(); + 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)); + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs new file mode 100644 index 000000000..fdaa21921 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/AddPhoneNumber.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class AddPhoneNumber { + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + + /// + /// PhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox PhoneNumber; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx new file mode 100644 index 000000000..9762ac521 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+ +

+ Thank you for confirming your account. Click here to login +

+
+ +

+ An error has occurred. +

+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.cs new file mode 100644 index 000000000..4532ef55f --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.cs @@ -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(); + var result = manager.ConfirmEmail(userId, code); + if (result.Succeeded) + { + successPanel.Visible = true; + return; + } + } + successPanel.Visible = false; + errorPanel.Visible = true; + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs new file mode 100644 index 000000000..085f00912 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Confirm.aspx.designer.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class Confirm { + + /// + /// successPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder successPanel; + + /// + /// login control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink login; + + /// + /// errorPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder errorPanel; + + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx new file mode 100644 index 000000000..03cf5b8c3 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+
+ +
+

Forgot your password?

+
+ +

+ +

+
+
+ Email +
+ + +
+
+
+
+ +
+
+
+
+ +

+ Please check your email to reset your password. +

+
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.cs new file mode 100644 index 000000000..3344eb061 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.cs @@ -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(); + 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 here."); + loginForm.Visible = false; + DisplayEmail.Visible = true; + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs new file mode 100644 index 000000000..eda65605a --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Forgot.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class ForgotPassword { + + /// + /// loginForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder loginForm; + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage; + + /// + /// FailureText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal FailureText; + + /// + /// Email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Email; + + /// + /// DisplayEmail control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder DisplayEmail; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx new file mode 100644 index 000000000..f2a8e65de --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx @@ -0,0 +1,8 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Lockout.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Lockout" %> + + +
+

Locked out.

+

This account has been locked out, please try again later.

+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.cs new file mode 100644 index 000000000..226921a70 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.cs @@ -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) + { + + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs new file mode 100644 index 000000000..905e9f20d --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Lockout.aspx.designer.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account +{ + + + public partial class Lockout + { + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx new file mode 100644 index 000000000..7118fb139 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+
+
+
+

Use a local account to log in.

+
+ +

+ +

+
+
+ Email +
+ + +
+
+
+ Password +
+ + +
+
+
+
+
+ + Remember me? +
+
+
+
+
+ +
+
+
+

+ Register as a new user +

+

+ <%-- Enable this once you have account confirmation enabled for password reset functionality + Forgot your password? + --%> +

+
+
+ +
+
+ +
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.cs new file mode 100644 index 000000000..b3bc806b0 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.cs @@ -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(); + var signinManager = Context.GetOwinContext().GetUserManager(); + + // 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; + } + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs new file mode 100644 index 000000000..067064914 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Login.aspx.designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class Login { + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage; + + /// + /// FailureText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal FailureText; + + /// + /// Email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Email; + + /// + /// Password control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Password; + + /// + /// RememberMe control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox RememberMe; + + /// + /// RegisterHyperLink control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink RegisterHyperLink; + + /// + /// OpenAuthLogin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::eShopOnContainers.Catalog.WebForms.Account.OpenAuthProviders OpenAuthLogin; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx new file mode 100644 index 000000000..0e81d72bb --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+ +

<%: SuccessMessage %>

+
+
+ +
+
+
+

Change your account settings

+
+
+
Password:
+
+ + +
+
External Logins:
+
<%: LoginsCount %> + + +
+ <%-- + Phone Numbers can used as a second factor of verification in a two-factor authentication system. + See this article + 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 + --%> + <%-- +
Phone Number:
+ <% if (HasPhoneNumber) + { %> +
+ +
+ <% } + else + { %> +
+ +  |  + +
+ <% } %> + --%> + +
Two-Factor Authentication:
+
+

+ There are no two-factor authentication providers configured. See this article + for details on setting up this ASP.NET application to support two-factor authentication. +

+ <% if (TwoFactorEnabled) + { %> + <%-- + Enabled + + --%> + <% } + else + { %> + <%-- + Disabled + + --%> + <% } %> +
+
+
+
+
+ +
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs new file mode 100644 index 000000000..65090e2fa --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.cs @@ -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(); + + 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(); + var signInManager = Context.GetOwinContext().Get(); + 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(); + manager.SetTwoFactorEnabled(User.Identity.GetUserId(), false); + + Response.Redirect("/Account/Manage"); + } + + //EnableTwoFactorAuthentication + protected void TwoFactorEnable_Click(object sender, EventArgs e) + { + var manager = Context.GetOwinContext().GetUserManager(); + manager.SetTwoFactorEnabled(User.Identity.GetUserId(), true); + + Response.Redirect("/Account/Manage"); + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs new file mode 100644 index 000000000..6fec7353b --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Manage.aspx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class Manage { + + /// + /// successMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder successMessage; + + /// + /// ChangePassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink ChangePassword; + + /// + /// CreatePassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink CreatePassword; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx new file mode 100644 index 000000000..56966dea0 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx @@ -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" %> + + +

Manage your external logins.

+ +

<%: SuccessMessage %>

+
+
+
+ + + + +

Registered Logins

+ + + + +
+ +
+ + + <%#: Item.LoginProvider %> + + + + + +
+ +
+
+
+ +
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.cs new file mode 100644 index 000000000..63d6b89a6 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.cs @@ -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(); + CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1; + + SuccessMessage = String.Empty; + successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage); + } + + public IEnumerable GetLogins() + { + var manager = Context.GetOwinContext().GetUserManager(); + 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(); + var signInManager = Context.GetOwinContext().Get(); + 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); + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs new file mode 100644 index 000000000..476637633 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManageLogins.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class ManageLogins { + + /// + /// successMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder successMessage; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx new file mode 100644 index 000000000..e6b8a3ced --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx @@ -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" %> + + +

<%: Title %>.

+
+
+ +

+ You do not have a local password for this site. Add a local + password so you can log in without an external login. +

+
+

Set Password Form

+ +
+
+ Password +
+ + + +
+
+ +
+ Confirm password +
+ + + + +
+
+
+
+ +
+
+
+
+ + +
+

Change Password Form

+
+ +
+ Current password +
+ + +
+
+
+ New password +
+ + +
+
+
+ Confirm new password +
+ + + +
+
+
+
+ +
+
+
+
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.cs new file mode 100644 index 000000000..d6294fc22 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.cs @@ -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(); + + 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(); + var signInManager = Context.GetOwinContext().Get(); + 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(); + 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); + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs new file mode 100644 index 000000000..e9ab28fb0 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ManagePassword.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class ManagePassword { + + /// + /// setPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder setPassword; + + /// + /// password control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox password; + + /// + /// confirmPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox confirmPassword; + + /// + /// changePasswordHolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder changePasswordHolder; + + /// + /// CurrentPasswordLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label CurrentPasswordLabel; + + /// + /// CurrentPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox CurrentPassword; + + /// + /// NewPasswordLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label NewPasswordLabel; + + /// + /// NewPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox NewPassword; + + /// + /// ConfirmNewPasswordLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label ConfirmNewPasswordLabel; + + /// + /// ConfirmNewPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox ConfirmNewPassword; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx new file mode 100644 index 000000000..30a51b720 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx @@ -0,0 +1,22 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OpenAuthProviders.ascx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.OpenAuthProviders" %> + +
+

Use another service to log in.

+
+ + +

+ +

+
+ +
+

There are no external authentication services configured. See this article for details on setting up this ASP.NET application to support logging in via external services.

+
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.cs new file mode 100644 index 000000000..4ff9e3673 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.cs @@ -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 GetProviderNames() + { + return Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes().Select(t => t.AuthenticationType); + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs new file mode 100644 index 000000000..14fec40f8 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/OpenAuthProviders.ascx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class OpenAuthProviders { + + /// + /// providerDetails control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ListView providerDetails; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx new file mode 100644 index 000000000..5287343ab --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx @@ -0,0 +1,45 @@ +<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.Account.Register" %> + + +

<%: Title %>.

+

+ +

+ +
+

Create a new account

+
+ +
+ Email +
+ + +
+
+
+ Password +
+ + +
+
+
+ Confirm password +
+ + + +
+
+
+
+ +
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.cs new file mode 100644 index 000000000..d9f2dd530 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.cs @@ -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(); + var signInManager = Context.GetOwinContext().Get(); + 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 here."); + + signInManager.SignIn( user, isPersistent: false, rememberBrowser: false); + IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response); + } + else + { + ErrorMessage.Text = result.Errors.FirstOrDefault(); + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs new file mode 100644 index 000000000..ca79aff15 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Register.aspx.designer.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class Register { + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + + /// + /// Email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Email; + + /// + /// Password control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Password; + + /// + /// ConfirmPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox ConfirmPassword; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx new file mode 100644 index 000000000..f711c4ad1 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx @@ -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" %> + + +

Register with your <%: ProviderName %> account

+ + +
+

Association Form

+
+ +

+ You've authenticated with <%: ProviderName %>. Please enter an email below for the current site + and click the Log in button. +

+ +
+ Email +
+ + + +
+
+ +
+
+ +
+
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.cs new file mode 100644 index 000000000..d0271e2bc --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.cs @@ -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(); + var signInManager = Context.GetOwinContext().Get(); + 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(); + var signInManager = Context.GetOwinContext().GetUserManager(); + 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); + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs new file mode 100644 index 000000000..6fbace51d --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/RegisterExternalLogin.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class RegisterExternalLogin { + + /// + /// email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox email; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx new file mode 100644 index 000000000..dacdf8b9e --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx @@ -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" %> + + +

<%: Title %>.

+

+ +

+ +
+

Enter your new password

+
+ +
+ Email +
+ + +
+
+
+ Password +
+ + +
+
+
+ Confirm password +
+ + + +
+
+
+
+ +
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.cs new file mode 100644 index 000000000..15697355f --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.cs @@ -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(); + + 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"; + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs new file mode 100644 index 000000000..f2dca2447 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPassword.aspx.designer.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class ResetPassword { + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + + /// + /// Email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Email; + + /// + /// Password control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Password; + + /// + /// ConfirmPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox ConfirmPassword; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx new file mode 100644 index 000000000..6ab2f510e --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx @@ -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" %> + + +

<%: Title %>.

+
+

Your password has been changed. Click here to login

+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.cs new file mode 100644 index 000000000..5f9fa52f7 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.cs @@ -0,0 +1,8 @@ +using System.Web.UI; + +namespace eShopOnContainers.Catalog.WebForms.Account +{ + public partial class ResetPasswordConfirmation : Page + { + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs new file mode 100644 index 000000000..e8a86f76a --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/ResetPasswordConfirmation.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class ResetPasswordConfirmation { + + /// + /// login control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink login; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx new file mode 100644 index 000000000..477111ca9 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx @@ -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" %> + + +

<%: Title %>.

+ +
+

Send verification code

+
+
+
+ Select Two-Factor Authentication Provider: + + + +
+
+
+
+ +
+

Enter verification code

+
+ + +

+ +

+
+
+ +
+ +
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.cs new file mode 100644 index 000000000..c0d605b58 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.cs @@ -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(); + signinManager = Context.GetOwinContext().GetUserManager(); + } + + protected void Page_Load(object sender, EventArgs e) + { + var userId = signinManager.GetVerifiedUserId(); + 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(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()); + if (user != null) + { + var code = manager.GenerateTwoFactorToken(user.Id, Providers.SelectedValue); + } + + SelectedProvider.Value = Providers.SelectedValue; + sendcode.Visible = false; + verifycode.Visible = true; + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs new file mode 100644 index 000000000..d87078d94 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/TwoFactorAuthenticationSignIn.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class TwoFactorAuthenticationSignIn { + + /// + /// sendcode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder sendcode; + + /// + /// Providers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList Providers; + + /// + /// ProviderSubmit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button ProviderSubmit; + + /// + /// verifycode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder verifycode; + + /// + /// SelectedProvider control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField SelectedProvider; + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ErrorMessage; + + /// + /// FailureText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal FailureText; + + /// + /// Code control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Code; + + /// + /// RememberBrowser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox RememberBrowser; + + /// + /// CodeSubmit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button CodeSubmit; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx new file mode 100644 index 000000000..e6e495e6c --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx @@ -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" %> + + +

<%: Title %>.

+

+ +

+
+

Enter verification code

+
+ + +
+ Code +
+ + +
+
+
+
+ +
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.cs new file mode 100644 index 000000000..96893dd36 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.cs @@ -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(); + 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(); + var signInManager = Context.GetOwinContext().Get(); + + 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"); + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs new file mode 100644 index 000000000..a91470458 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/VerifyPhoneNumber.aspx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms.Account { + + + public partial class VerifyPhoneNumber { + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + + /// + /// PhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField PhoneNumber; + + /// + /// Code control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox Code; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config new file mode 100644 index 000000000..90fe314f6 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Account/Web.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs index 5545407fa..89e7b8b2c 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/BundleConfig.cs @@ -5,7 +5,7 @@ using System.Web; using System.Web.Optimization; using System.Web.UI; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public class BundleConfig { @@ -34,7 +34,7 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); - System.Web.UI.ScriptManager.ScriptResourceMapping.AddDefinition( + ScriptManager.ScriptResourceMapping.AddDefinition( "respond", new ScriptResourceDefinition { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/IdentityConfig.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/IdentityConfig.cs new file mode 100644 index 000000000..d8a9d95d3 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/IdentityConfig.cs @@ -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 + { + public ApplicationUserManager(IUserStore store) + : base(store) + { + } + + public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context) + { + var manager = new ApplicationUserManager(new UserStore(context.Get())); + // Configure validation logic for usernames + manager.UserValidator = new UserValidator(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 + { + MessageFormat = "Your security code is {0}" + }); + manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider + { + 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(dataProtectionProvider.Create("ASP.NET Identity")); + } + return manager; + } + } + + public class ApplicationSignInManager : SignInManager + { + public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) : + base(userManager, authenticationManager) { } + + public override Task CreateUserIdentityAsync(ApplicationUser user) + { + return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager); + } + + public static ApplicationSignInManager Create(IdentityFactoryOptions options, IOwinContext context) + { + return new ApplicationSignInManager(context.GetUserManager(), context.Authentication); + } + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs index 723f636c7..f038ae775 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/RouteConfig.cs @@ -4,7 +4,7 @@ using System.Web; using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public static class RouteConfig { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/Startup.Auth.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/Startup.Auth.cs new file mode 100644 index 000000000..a800d3136 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/App_Start/Startup.Auth.cs @@ -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.Create); + app.CreatePerOwinContext(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( + 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 = "" + //}); + } + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj b/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj index 7a3595f36..f2065f73e 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj @@ -9,13 +9,13 @@ 2.0 - {07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB} + {487A4E92-FAA3-415C-A019-6EDADB8AB1D9} {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties - Microsoft.eShopOnContainers.Catalog.WebForms - Catalog.WebForms - v4.5.2 + eShopOnContainers.Catalog.WebForms + eShopOnContainers.Catalog.WebForms + v4.6.2 true @@ -44,8 +44,8 @@ 4 - - ..\packages\Autofac.4.3.0\lib\net45\Autofac.dll + + ..\packages\Autofac.4.4.0\lib\net45\Autofac.dll ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll @@ -106,6 +106,54 @@ ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + + ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll + + + ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll + + + ..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll + + + ..\packages\Microsoft.AspNet.Providers.Core.2.0.0\lib\net40\System.Web.Providers.dll + + + ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll + + + ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll + + + ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll + + + ..\packages\Microsoft.Owin.Security.Facebook.3.0.1\lib\net45\Microsoft.Owin.Security.Facebook.dll + + + ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll + + + ..\packages\Microsoft.Owin.Security.Google.3.0.1\lib\net45\Microsoft.Owin.Security.Google.dll + + + ..\packages\Microsoft.Owin.Security.Twitter.3.0.1\lib\net45\Microsoft.Owin.Security.Twitter.dll + + + ..\packages\Microsoft.Owin.Security.MicrosoftAccount.3.0.1\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll + ..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll @@ -130,10 +178,26 @@ + + + + + + + + + + + + + + + + @@ -141,22 +205,21 @@ + + + + PreserveNewest - - - Dockerfile - - @@ -193,6 +256,111 @@ + + AddPhoneNumber.aspx + ASPXCodeBehind + + + AddPhoneNumber.aspx + + + Confirm.aspx + ASPXCodeBehind + + + Confirm.aspx + + + Forgot.aspx + ASPXCodeBehind + + + Forgot.aspx + + + Lockout.aspx + ASPXCodeBehind + + + Lockout.aspx + + + Login.aspx + ASPXCodeBehind + + + Login.aspx + + + Manage.aspx + ASPXCodeBehind + + + Manage.aspx + + + ManageLogins.aspx + ASPXCodeBehind + + + ManageLogins.aspx + + + ManagePassword.aspx + ASPXCodeBehind + + + ManagePassword.aspx + + + OpenAuthProviders.ascx + ASPXCodeBehind + + + OpenAuthProviders.ascx + + + Register.aspx + ASPXCodeBehind + + + Register.aspx + + + RegisterExternalLogin.aspx + ASPXCodeBehind + + + RegisterExternalLogin.aspx + + + ResetPassword.aspx + ASPXCodeBehind + + + ResetPassword.aspx + + + ResetPasswordConfirmation.aspx + ASPXCodeBehind + + + ResetPasswordConfirmation.aspx + + + TwoFactorAuthenticationSignIn.aspx + ASPXCodeBehind + + + TwoFactorAuthenticationSignIn.aspx + + + VerifyPhoneNumber.aspx + ASPXCodeBehind + + + VerifyPhoneNumber.aspx + About.aspx @@ -201,7 +369,9 @@ About.aspx + + Contact.aspx ASPXCodeBehind @@ -216,6 +386,13 @@ Default.aspx + + EditCatalogItem.aspx + ASPXCodeBehind + + + EditCatalogItem.aspx + Global.asax @@ -224,6 +401,7 @@ + @@ -245,6 +423,7 @@ Site.Mobile.Master + ViewSwitcher.ascx ASPXCodeBehind @@ -279,7 +458,7 @@ True True - 58178 + 55489 / http://localhost:58178/ False diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx index 3f7dc898e..3091b5e77 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx @@ -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" %>

<%: Title %>.

diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs index 9dea43042..7a50ef5a5 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.cs @@ -5,7 +5,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public partial class Contact : Page { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs index 183419d9d..3b9f538f1 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Contact.aspx.designer.cs @@ -3,13 +3,15 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { - - - public partial class Contact { +namespace eShopOnContainers.Catalog.WebForms +{ + + + public partial class Contact + { } } diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css b/src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css index a9f861550..4cf204918 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Content/Site.css @@ -11,20 +11,27 @@ body { padding-right: 15px; } +/* Override the default bootstrap behavior where horizontal description lists + will truncate terms that are too long to fit in the left column +*/ +.dl-horizontal dt { + white-space: normal; +} + /* Set widths on the form inputs since otherwise they're 100% wide */ -input, -select, -textarea { +input[type="text"], +input[type="password"], +input[type="email"], +input[type="tel"], +input[type="select"] { max-width: 280px; } - /* Responsive: Portrait tablets and up */ @media screen and (min-width: 768px) { .jumbotron { margin-top: 20px; } - .body-content { padding: 0; } diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css b/src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css index 39ba1cc43..3d0708373 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Content/catalog.component.css @@ -35,7 +35,7 @@ .esh-catalog-filter option { background-color: #00A69C; } - +*/ .esh-catalog-label { display: inline-block; position: relative; @@ -63,7 +63,7 @@ width: 10px; z-index: 1; } - + /* .esh-catalog-send { background-color: #83D01B; color: #FFFFFF; diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx index 6533feb30..14f353e4e 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx @@ -1,29 +1,10 @@ -<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms._Default" Async="true" %> +<%@ Page Title="eShopOnContainers - Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" + CodeBehind="Default.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms._Default" Async="true" %> -
-
- -
-
-
-
- - - - - - - -
-
+ ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem" SelectMethod="catalogList_GetData" DeleteMethod="catalogList_DeleteItem">
There's nothing in the catalog to display at this time. @@ -37,21 +18,28 @@
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs index 29aa6f831..b2c90de7c 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.cs @@ -1,6 +1,4 @@ -using Autofac; -using Autofac.Core; -using eShopOnContainers.Core.Models.Catalog; +using eShopOnContainers.Core.Models.Catalog; using eShopOnContainers.Core.Services.Catalog; using System; using System.Collections.Generic; @@ -10,11 +8,12 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public partial class _Default : Page { private ICatalogService catalog; + private CatalogItem itemToEdit; protected _Default() { } @@ -23,23 +22,26 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms this.catalog = catalog; } - protected override void OnLoad(EventArgs e) + protected void Page_Load(object sender, EventArgs e) { - RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync)); - base.OnLoad(e); } - private async Task LoadCatalogDataAsync() + // The return type can be changed to IEnumerable, however to support + // paging and sorting, the following parameters must be added: + // int maximumRows + // int startRowIndex + // out int totalRowCount + // string sortByExpression + public async Task> catalogList_GetData() { - var collection = await catalog?.GetCatalogAsync(); - catalogList.DataSource = collection; - catalogList.DataBind(); + return await catalog?.GetCatalogAsync(); } - protected void Page_Load(object sender, EventArgs e) + // The id parameter name should match the DataKeyNames value set on the control + public async Task catalogList_DeleteItem(int id) { - + //TODO: Call the service. } } } \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs index cad33877a..c46ea42f2 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Default.aspx.designer.cs @@ -7,20 +7,11 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { +namespace eShopOnContainers.Catalog.WebForms { public partial class _Default { - /// - /// DataPager1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DataPager DataPager1; - /// /// catalogList control. /// diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Dockerfile b/src/Web/Catalog.WebForms/Catalog.WebForms/Dockerfile deleted file mode 100644 index f480e8dfb..000000000 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM microsoft/aspnet -ARG source -WORKDIR /inetpub/wwwroot -COPY ${source:-obj/Docker/publish} . diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx new file mode 100644 index 000000000..c26d5673a --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx @@ -0,0 +1,41 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="EditCatalogItem.aspx.cs" Inherits="eShopOnContainers.Catalog.WebForms.EditCatalogItem" Async="true" %> + + + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ This is where the picture to edit goes +
+
+
+
+ +
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs new file mode 100644 index 000000000..31f67a0fa --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs @@ -0,0 +1,72 @@ +using eShopOnContainers.Core.Models.Catalog; +using eShopOnContainers.Core.Services.Catalog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Web; +using System.Web.ModelBinding; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace eShopOnContainers.Catalog.WebForms +{ + public partial class EditCatalogItem : System.Web.UI.Page + { + private ICatalogService catalog; + + public IEnumerable Brands; + public IEnumerable 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 EditCatalogItemForm_GetItem([QueryString]int id) + { + // TODO: If null, go into insert mode. + var itemToEdit = await catalog?.GetCatalogItemAsync(id.ToString()); + return itemToEdit; + } + + // The id parameter name should match the DataKeyNames value set on the control + public void EditCatalogItemForm_UpdateItem(int id) + { + eShopOnContainers.Core.Models.Catalog.CatalogItem item = null; + // Load the item here, e.g. item = MyDataLayer.Find(id); + if (item == null) + { + // The item wasn't found + ModelState.AddModelError("", String.Format("Item with id {0} was not found", id)); + return; + } + TryUpdateModel(item); + if (ModelState.IsValid) + { + // Save changes here, e.g. MyDataLayer.SaveChanges(); + + } + } + + public void EditCatalogItemForm_InsertItem() + { + var item = new eShopOnContainers.Core.Models.Catalog.CatalogItem(); + TryUpdateModel(item); + if (ModelState.IsValid) + { + // Save changes here + + } + } + } +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs new file mode 100644 index 000000000..1a6b38029 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace eShopOnContainers.Catalog.WebForms { + + + public partial class EditCatalogItem { + + /// + /// EditCatalogItemForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.FormView EditCatalogItemForm; + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax b/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax index b3682de02..556f0c30d 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax @@ -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#" %> diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs index f0e204417..33c088408 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Global.asax.cs @@ -1,19 +1,21 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Web; using System.Web.Optimization; 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 { - void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); - } } } \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs index 3e2fd6a68..20b0b8a6c 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogItem.cs @@ -14,4 +14,4 @@ namespace eShopOnContainers.Core.Models.Catalog public int CatalogTypeId { get; set; } public string CatalogType { get; set; } } -} +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs index eef40f88b..7f704805c 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogRoot.cs @@ -9,4 +9,4 @@ namespace eShopOnContainers.Core.Models.Catalog public int Count { get; set; } public List Data { get; set; } } -} +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs index 696cd129f..0fe31dc9e 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/CatalogType.cs @@ -9,4 +9,4 @@ namespace eShopOnContainers.Core.Models.Catalog public override string ToString() => Type; } -} +} \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Models/IdentityModels.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/IdentityModels.cs new file mode 100644 index 000000000..a7483de28 --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Models/IdentityModels.cs @@ -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 GenerateUserIdentityAsync(ApplicationUserManager manager) + { + return Task.FromResult(GenerateUserIdentity(manager)); + } + } + + public class ApplicationDbContext : IdentityDbContext + { + 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 diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs index 78314fa94..471edbd18 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs @@ -7,7 +7,7 @@ using System.Web; using System.Web.Configuration; using System.Web.UI; -namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules +namespace eShopOnContainers.Catalog.WebForms.Modules { // Using DI with WebForms is not yet implemented. // This implementation has been adapted from this post: diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs index 9113da386..e2f8e57f7 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // 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: // diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master index 154a459c9..0c44d4264 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master @@ -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" %> @@ -11,8 +11,7 @@ <%: Scripts.Render("~/bundles/modernizr") %> - - + @@ -40,37 +39,43 @@ -
+
+
+ +
+
+

-
-
-
+
+
+
-
- -
+
+ +
-
- -
+
+ +
-
-
-
+
+
+
diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs index c839fea66..d0765f45f 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.cs @@ -1,17 +1,81 @@ using System; using System.Collections.Generic; -using System.Linq; +using System.Security.Claims; +using System.Security.Principal; using System.Web; +using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; +using Microsoft.AspNet.Identity; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { 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 Unnamed_LoggingOut(object sender, LoginCancelEventArgs e) + { + Context.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie); + } } + } \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs index 05b24a5a7..a2171daf0 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Master.designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { +namespace eShopOnContainers.Catalog.WebForms { public partial class SiteMaster { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master index e150e06ac..d086acdfc 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master @@ -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" %> diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs index 646cc9443..a0b4cdc91 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.cs @@ -5,7 +5,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public partial class Site_Mobile : System.Web.UI.MasterPage { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs index e48aed426..489a490e9 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Site.Mobile.Master.designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { +namespace eShopOnContainers.Catalog.WebForms { public partial class Site_Mobile { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs new file mode 100644 index 000000000..66d4a84ca --- /dev/null +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Startup.cs @@ -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); + } + } +} diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx index 72717bf6e..1f6576fe0 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx @@ -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" %>
<%: CurrentView %> view | Switch to <%: AlternateView %>
\ No newline at end of file diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs index d6212623b..09dd9daf1 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.cs @@ -7,7 +7,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.AspNet.FriendlyUrls.Resolvers; -namespace Microsoft.eShopOnContainers.Catalog.WebForms +namespace eShopOnContainers.Catalog.WebForms { public partial class ViewSwitcher : System.Web.UI.UserControl { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs index 7cf9ae76d..ddfd1d3ff 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/ViewSwitcher.ascx.designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.eShopOnContainers.Catalog.WebForms { +namespace eShopOnContainers.Catalog.WebForms { public partial class ViewSwitcher { diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Web.config b/src/Web/Catalog.WebForms/Catalog.WebForms/Web.config index 0c98f5b70..ddc1f540f 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Web.config +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Web.config @@ -4,26 +4,78 @@ https://go.microsoft.com/fwlink/?LinkId=169433 --> + + +
+ + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + @@ -33,18 +85,39 @@ - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/packages.config b/src/Web/Catalog.WebForms/Catalog.WebForms/packages.config index 756f567ce..1a689f8ea 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/packages.config +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/packages.config @@ -1,29 +1,44 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/docker-compose.ci.build.yml b/src/Web/Catalog.WebForms/docker-compose.ci.build.yml deleted file mode 100644 index 045fdea67..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.ci.build.yml +++ /dev/null @@ -1 +0,0 @@ -version: '2.1' diff --git a/src/Web/Catalog.WebForms/docker-compose.dcproj b/src/Web/Catalog.WebForms/docker-compose.dcproj deleted file mode 100644 index 7d8443045..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.dcproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - 7816bbb6-20b9-4d5a-864d-47b7c6e3d3d5 - True - http://{ServiceIPAddress} - catalog.webforms - - - - - docker-compose.yml - - - docker-compose.yml - - - docker-compose.yml - - - - \ No newline at end of file diff --git a/src/Web/Catalog.WebForms/docker-compose.override.yml b/src/Web/Catalog.WebForms/docker-compose.override.yml deleted file mode 100644 index a3964d9f8..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.override.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: '2.1' - -services: - sql.data: - environment: - - ACCEPT_EULA=Y - - catalog.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - #- ExternalCatalogBaseUrl=http://13.88.8.119:5101 #Remote: VM Needs to have public access at 5105. - - ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - ports: - - "5101:5101" - - catalog.webforms: - ports: - - "80" -networks: - default: - external: - name: nat diff --git a/src/Web/Catalog.WebForms/docker-compose.vs.debug.yml b/src/Web/Catalog.WebForms/docker-compose.vs.debug.yml deleted file mode 100644 index 45fd19caa..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.vs.debug.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: '2.1' - -services: - catalog.api: - image: eshop/catalog.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ../../Services/Catalog/Catalog.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - catalog.webforms: - image: catalog.webforms:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - .\Catalog.WebForms:C:\inetpub\wwwroot - - ~\msvsmon:C:\msvsmon:ro - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=windows" diff --git a/src/Web/Catalog.WebForms/docker-compose.vs.release.yml b/src/Web/Catalog.WebForms/docker-compose.vs.release.yml deleted file mode 100644 index 0ee520ed5..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.vs.release.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '2.1' - -services: - catalog.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - catalog.webforms: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~\msvsmon:C:\msvsmon:ro - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=windows" diff --git a/src/Web/Catalog.WebForms/docker-compose.yml b/src/Web/Catalog.WebForms/docker-compose.yml deleted file mode 100644 index 9b27f2cd1..000000000 --- a/src/Web/Catalog.WebForms/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2.1' - -services: - catalog.webforms: - image: catalog.webforms - build: - context: .\Catalog.WebForms - dockerfile: Dockerfile - depends_on: - - catalog.api - - catalog.api: - image: eshop/catalog.api - build: - context: ../../Services/Catalog/Catalog.API - dockerfile: Dockerfile.nanowin - depends_on: - - sql.data - - sql.data: - image: microsoft/mssql-server-windows -