diff --git a/src/MusicStore.Spa/MusicStore.Spa.xproj b/src/MusicStore.Spa/MusicStore.Spa.xproj index 8a12e79474..ceeb8a3678 100644 --- a/src/MusicStore.Spa/MusicStore.Spa.xproj +++ b/src/MusicStore.Spa/MusicStore.Spa.xproj @@ -13,6 +13,7 @@ 2.0 1575 + True \ No newline at end of file diff --git a/src/MusicStore/Controllers/AccountController.cs b/src/MusicStore/Controllers/AccountController.cs index 23012bc11e..9324179580 100644 --- a/src/MusicStore/Controllers/AccountController.cs +++ b/src/MusicStore/Controllers/AccountController.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Security.Claims; -using System.Security.Principal; using System.Threading.Tasks; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Hosting; diff --git a/src/MusicStore/Controllers/HomeController.cs b/src/MusicStore/Controllers/HomeController.cs index 5ce9ae8967..c9dd44a3bd 100644 --- a/src/MusicStore/Controllers/HomeController.cs +++ b/src/MusicStore/Controllers/HomeController.cs @@ -33,8 +33,6 @@ namespace MusicStore.Controllers return View(albums); } - //Can be removed and handled when HandleError filter is implemented - //https://github.com/aspnet/Mvc/issues/623 public IActionResult Error() { return View("~/Views/Shared/Error.cshtml"); diff --git a/src/MusicStore/Properties/AppSettings.cs b/src/MusicStore/Properties/AppSettings.cs new file mode 100644 index 0000000000..ce51983a25 --- /dev/null +++ b/src/MusicStore/Properties/AppSettings.cs @@ -0,0 +1,7 @@ +namespace MusicStore +{ + public class AppSettings + { + public string SiteTitle { get; set; } + } +} \ No newline at end of file diff --git a/src/MusicStore/Scripts/_references.js b/src/MusicStore/Scripts/_references.js index 1e06d0efc2..a92c2bf236 100644 --- a/src/MusicStore/Scripts/_references.js +++ b/src/MusicStore/Scripts/_references.js @@ -1,8 +1,8 @@ /// -/// -/// -/// -/// -/// -/// /// +/// +/// +/// +/// +/// +/// diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index d1690a80fa..7b3907c29e 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -28,6 +28,8 @@ namespace MusicStore public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSubKey("AppSettings")); + //Sql client not available on mono var useInMemoryStore = Type.GetType("Mono.Runtime") != null; diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index ed1c6cb15a..f5bcd8409a 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -43,6 +43,8 @@ namespace MusicStore public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSubKey("AppSettings")); + // Add EF services to the services container services.AddEntityFramework() .AddSqlServer() diff --git a/src/MusicStore/StartupOpenIdConnect.cs b/src/MusicStore/StartupOpenIdConnect.cs index 6ec124342e..ab641c7004 100644 --- a/src/MusicStore/StartupOpenIdConnect.cs +++ b/src/MusicStore/StartupOpenIdConnect.cs @@ -41,6 +41,8 @@ namespace MusicStore public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSubKey("AppSettings")); + //Sql client not available on mono var useInMemoryStore = Type.GetType("Mono.Runtime") != null; diff --git a/src/MusicStore/Views/Account/ConfirmEmail.cshtml b/src/MusicStore/Views/Account/ConfirmEmail.cshtml index 5608c5460a..d8822d5099 100644 --- a/src/MusicStore/Views/Account/ConfirmEmail.cshtml +++ b/src/MusicStore/Views/Account/ConfirmEmail.cshtml @@ -5,6 +5,6 @@

@ViewBag.Title.

- Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) + Thank you for confirming your email. Please Click here to Log in.

\ No newline at end of file diff --git a/src/MusicStore/Views/Account/ExternalLoginConfirmation.cshtml b/src/MusicStore/Views/Account/ExternalLoginConfirmation.cshtml index c7811a5201..3e7d2dea54 100644 --- a/src/MusicStore/Views/Account/ExternalLoginConfirmation.cshtml +++ b/src/MusicStore/Views/Account/ExternalLoginConfirmation.cshtml @@ -1,27 +1,25 @@ -@model MusicStore.Models.ExternalLoginConfirmationViewModel +@model ExternalLoginConfirmationViewModel @{ ViewBag.Title = "Register"; }

@ViewBag.Title.

Associate your @ViewBag.LoginProvider account.

-@using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() - +

Association Form


- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) +
+

You've successfully authenticated with @ViewBag.LoginProvider. Please enter a user name for this site below and click the Register button to finish logging in.

- @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) - @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) + +
@@ -29,11 +27,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Account/ExternalLoginFailure.cshtml b/src/MusicStore/Views/Account/ExternalLoginFailure.cshtml index 3be4ab37d4..cb96d08e07 100644 --- a/src/MusicStore/Views/Account/ExternalLoginFailure.cshtml +++ b/src/MusicStore/Views/Account/ExternalLoginFailure.cshtml @@ -5,4 +5,4 @@

@ViewBag.Title.

Unsuccessful login with service.

-
+ \ No newline at end of file diff --git a/src/MusicStore/Views/Account/ForgotPassword.cshtml b/src/MusicStore/Views/Account/ForgotPassword.cshtml index 063998e4b4..605b048f9f 100644 --- a/src/MusicStore/Views/Account/ForgotPassword.cshtml +++ b/src/MusicStore/Views/Account/ForgotPassword.cshtml @@ -1,20 +1,19 @@ -@model MusicStore.Models.ForgotPasswordViewModel +@model ForgotPasswordViewModel @{ ViewBag.Title = "Forgot your password?"; }

@ViewBag.Title.

-@using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() +

Enter your email.


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + +
@@ -22,11 +21,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } diff --git a/src/MusicStore/Views/Account/ForgotPasswordConfirmation.cshtml b/src/MusicStore/Views/Account/ForgotPasswordConfirmation.cshtml index 2ba9d0ca72..80bb848fbe 100644 --- a/src/MusicStore/Views/Account/ForgotPasswordConfirmation.cshtml +++ b/src/MusicStore/Views/Account/ForgotPasswordConfirmation.cshtml @@ -10,6 +10,6 @@ Please check your email to reset your password.

- For demo purpose only: @Html.ActionLink("Click here to reset the password: ", "ResetPassword", new { code = ViewBag.Code }); + For demo purpose only: Click here to reset the password

\ No newline at end of file diff --git a/src/MusicStore/Views/Account/Login.cshtml b/src/MusicStore/Views/Account/Login.cshtml index 27a628c27c..69867f4987 100644 --- a/src/MusicStore/Views/Account/Login.cshtml +++ b/src/MusicStore/Views/Account/Login.cshtml @@ -1,5 +1,4 @@ -@using MusicStore.Models -@model LoginViewModel +@model LoginViewModel @{ ViewBag.Title = "Log in"; @@ -9,31 +8,29 @@
- @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) - { - @Html.AntiForgeryToken() +

Use a local account to log in.


- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) - @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) + +
- @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) - @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" }) + +
- @Html.CheckBoxFor(m => m.RememberMe) - @Html.LabelFor(m => m.RememberMe) + +
@@ -43,13 +40,12 @@

- @Html.ActionLink("Register as a new user", "Register") + Register as a new user?

- @*Enable this once you have account confirmation enabled for password reset functionality*@

- @Html.ActionLink("Forgot your password?", "ForgotPassword") + Forgot your password?

- } +
@@ -58,9 +54,7 @@
+ @section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Account/Register.cshtml b/src/MusicStore/Views/Account/Register.cshtml index 4f713e0756..22efc31c9a 100644 --- a/src/MusicStore/Views/Account/Register.cshtml +++ b/src/MusicStore/Views/Account/Register.cshtml @@ -1,32 +1,33 @@ -@model MusicStore.Models.RegisterViewModel +@model RegisterViewModel @{ ViewBag.Title = "Register"; }

@ViewBag.Title.

-@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() +

Create a new account.


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + +
@@ -34,11 +35,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Account/RegisterConfirmation.cshtml b/src/MusicStore/Views/Account/RegisterConfirmation.cshtml index 549f6ef105..13170498e9 100644 --- a/src/MusicStore/Views/Account/RegisterConfirmation.cshtml +++ b/src/MusicStore/Views/Account/RegisterConfirmation.cshtml @@ -10,6 +10,6 @@ Please check your email to activate your account.

- Demo/testing purposes only: The sample displays the code and user id in the page: @Html.ActionLink("Click here to confirm your email: ", "ConfirmEmail", new { code = ViewBag.Code, userId = ViewBag.UserId }) + Demo/testing purposes only: The sample displays the code and user id in the page: Click here to confirm your email:

\ No newline at end of file diff --git a/src/MusicStore/Views/Account/ResetPassword.cshtml b/src/MusicStore/Views/Account/ResetPassword.cshtml index 7ee7e8276a..504ce647d8 100644 --- a/src/MusicStore/Views/Account/ResetPassword.cshtml +++ b/src/MusicStore/Views/Account/ResetPassword.cshtml @@ -1,33 +1,34 @@ -@model MusicStore.Models.ResetPasswordViewModel +@model ResetPasswordViewModel @{ ViewBag.Title = "Reset password"; }

@ViewBag.Title.

-@using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() +

Reset your password.


- @Html.ValidationSummary("", new { @class = "text-danger" }) - @Html.HiddenFor(model => model.Code) +
+
- @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + +
@@ -35,11 +36,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Account/ResetPasswordConfirmation.cshtml b/src/MusicStore/Views/Account/ResetPasswordConfirmation.cshtml index 3804516176..0af2ecf753 100644 --- a/src/MusicStore/Views/Account/ResetPasswordConfirmation.cshtml +++ b/src/MusicStore/Views/Account/ResetPasswordConfirmation.cshtml @@ -7,6 +7,6 @@

- Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) + Your password has been reset. Please Click here to log in.

-
+ \ No newline at end of file diff --git a/src/MusicStore/Views/Account/SendCode.cshtml b/src/MusicStore/Views/Account/SendCode.cshtml index 1752f96d57..b16de7225d 100644 --- a/src/MusicStore/Views/Account/SendCode.cshtml +++ b/src/MusicStore/Views/Account/SendCode.cshtml @@ -1,28 +1,21 @@ -@model MusicStore.Models.SendCodeViewModel +@model SendCodeViewModel @{ - ViewBag.Title = "Send"; + ViewBag.Title = "Send Verification Code"; }

@ViewBag.Title.

-@using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() - @Html.Hidden("rememberMe", @Model.RememberMe) -

Send verification code

-
+
+
Select Two-Factor Authentication Provider: - @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers) +
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - -} \ No newline at end of file + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } +} diff --git a/src/MusicStore/Views/Account/VerifyCode.cshtml b/src/MusicStore/Views/Account/VerifyCode.cshtml index 36871d3dfd..5b4b0d2407 100644 --- a/src/MusicStore/Views/Account/VerifyCode.cshtml +++ b/src/MusicStore/Views/Account/VerifyCode.cshtml @@ -1,15 +1,14 @@ -@model MusicStore.Models.VerifyCodeViewModel +@model VerifyCodeViewModel @{ ViewBag.Title = "Verify"; }

@ViewBag.Title.

-@using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() - @Html.Hidden("provider", @Model.Provider) - @Html.Hidden("rememberMe", @Model.RememberMe) +
+
+ +

Enter verification code

For DEMO only: You can type in this code in the below text box to proceed: [ @ViewBag.Code ] @@ -17,18 +16,18 @@ Please change this code to register an SMS/Email service in IdentityConfig to send a message.


- @Html.ValidationSummary("", new { @class = "text-danger" })
- @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) + +
- @Html.CheckBoxFor(m => m.RememberBrowser) - @Html.LabelFor(m => m.RememberBrowser) + +
@@ -37,11 +36,8 @@ -} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - -} + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } +} \ No newline at end of file diff --git a/src/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml b/src/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml index 476ca4d1eb..210f134e03 100644 --- a/src/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml +++ b/src/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml @@ -1,6 +1,4 @@ -@using MusicStore.Models; -@using Microsoft.AspNet.Http.Authentication; -@using Microsoft.AspNet.Identity; +@using Microsoft.AspNet.Http.Authentication; @model ExternalLoginListViewModel @inject SignInManager SignInManager

Use another service to log in.

@@ -18,17 +16,15 @@ } else { - using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) - { - @Html.AntiForgeryToken() +

- @foreach (AuthenticationDescription p in loginProviders.Where(a => a.Caption != null)) + @foreach (AuthenticationDescription p in loginProviders) { }

- } +
} } \ No newline at end of file diff --git a/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml b/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml index c7269363e4..ca4b4eea6c 100644 --- a/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml +++ b/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml @@ -1,22 +1,17 @@ -@model MusicStore.Models.Order +@model Order @{ ViewBag.Title = "Address And Payment"; } @section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } -@using (Html.BeginForm()) -{ - @Html.AntiForgeryToken() +

Address And Payment


- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) +
Shipping Information @@ -27,7 +22,7 @@

We're running a promotion: all music is free with the promo code: "FREE"

- @Html.Label("Promo Code") +
@Html.TextBox("PromoCode") @@ -35,4 +30,4 @@
-} \ No newline at end of file +
\ No newline at end of file diff --git a/src/MusicStore/Views/Checkout/Complete.cshtml b/src/MusicStore/Views/Checkout/Complete.cshtml index 9546e23626..14b8db5117 100644 --- a/src/MusicStore/Views/Checkout/Complete.cshtml +++ b/src/MusicStore/Views/Checkout/Complete.cshtml @@ -10,5 +10,5 @@

How about shopping for some more music in our - @Html.ActionLink("Store", "Index", "Home") + Store

\ No newline at end of file diff --git a/src/MusicStore/Views/Home/Index.cshtml b/src/MusicStore/Views/Home/Index.cshtml index b908309310..6225876b9e 100644 --- a/src/MusicStore/Views/Home/Index.cshtml +++ b/src/MusicStore/Views/Home/Index.cshtml @@ -1,20 +1,21 @@ -@{ +@inject IOptions AppSettings +@{ ViewBag.Title = "Home Page"; }
-

MVC Music Store

+

@AppSettings.Options.SiteTitle

\ No newline at end of file diff --git a/src/MusicStore/Views/Manage/AddPhoneNumber.cshtml b/src/MusicStore/Views/Manage/AddPhoneNumber.cshtml index 2252e07656..b77d01db28 100644 --- a/src/MusicStore/Views/Manage/AddPhoneNumber.cshtml +++ b/src/MusicStore/Views/Manage/AddPhoneNumber.cshtml @@ -1,32 +1,27 @@ -@model MusicStore.Models.AddPhoneNumberViewModel +@model AddPhoneNumberViewModel @{ - ViewBag.Title = "Phone Number"; + ViewBag.Title = "Add Phone Number"; }

@ViewBag.Title.

- -@using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() -

Add a phone number

+
+

Add a phone number.


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.Number, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Number, new { @class = "form-control" }) + +
- +
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Manage/ChangePassword.cshtml b/src/MusicStore/Views/Manage/ChangePassword.cshtml index 04edda2e27..d4fba73fb1 100644 --- a/src/MusicStore/Views/Manage/ChangePassword.cshtml +++ b/src/MusicStore/Views/Manage/ChangePassword.cshtml @@ -1,32 +1,33 @@ -@model MusicStore.Models.ChangePasswordViewModel +@model ChangePasswordViewModel @{ ViewBag.Title = "Change Password"; }

@ViewBag.Title.

-@using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() +

Change Password Form


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + +
@@ -34,10 +35,8 @@
-} +
+ @section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - -} \ No newline at end of file + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } +} diff --git a/src/MusicStore/Views/Manage/Index.cshtml b/src/MusicStore/Views/Manage/Index.cshtml index 0b78ee2fd9..a99a723f44 100644 --- a/src/MusicStore/Views/Manage/Index.cshtml +++ b/src/MusicStore/Views/Manage/Index.cshtml @@ -1,6 +1,6 @@ -@model MusicStore.Models.IndexViewModel +@model IndexViewModel @{ - ViewBag.Title = "Manage"; + ViewBag.Title = "Manage your account"; }

@ViewBag.Title.

@@ -15,18 +15,17 @@ [ @if (Model.HasPassword) { - @Html.ActionLink("Change your password", "ChangePassword") + Change } else { - @Html.ActionLink("Create", "SetPassword") + Create } ]
External Logins:
- @Model.Logins.Count [ - @Html.ActionLink("Manage", "ManageLogins") ] + @Model.Logins.Count [Manage]
@* Phone Numbers can used as a second factor of verification in a two-factor authentication system. @@ -42,13 +41,13 @@ @(Model.PhoneNumber ?? "None") [ @if (Model.PhoneNumber != null) { - @Html.ActionLink("Change", "AddPhoneNumber") + Change @:  |  - @Html.ActionLink("Remove", "RemovePhoneNumber") + Remove } else { - @Html.ActionLink("Add", "AddPhoneNumber") + Add } ] @@ -56,51 +55,43 @@
@if (Model.TwoFactor) { - using (Html.BeginForm("DisableTwoFactorAuthentication", "Manage", FormMethod.Post)) - { - @Html.AntiForgeryToken() +

Enabled

- } +
} else { - using (Html.BeginForm("EnableTwoFactorAuthentication", "Manage", FormMethod.Post)) - { - @Html.AntiForgeryToken() +

Disabled

- } +
}
Browser remembered:
@if (Model.BrowserRemembered) { - using (Html.BeginForm("ForgetBrowser", "Manage", FormMethod.Post)) - { - @Html.AntiForgeryToken() +

Browser is curently remembered for two factor:

- } +
} else { - using (Html.BeginForm("RememberBrowser", "Manage", FormMethod.Post)) - { - @Html.AntiForgeryToken() +

Browser is curently not remembered for two factor:

- } +
}
- + \ No newline at end of file diff --git a/src/MusicStore/Views/Manage/ManageLogins.cshtml b/src/MusicStore/Views/Manage/ManageLogins.cshtml index c66a54181b..0023a539e5 100644 --- a/src/MusicStore/Views/Manage/ManageLogins.cshtml +++ b/src/MusicStore/Views/Manage/ManageLogins.cshtml @@ -1,5 +1,5 @@ @using Microsoft.AspNet.Http.Authentication; -@model MusicStore.Models.ManageLoginsViewModel +@model ManageLoginsViewModel @{ ViewBag.Title = "Manage your external logins"; } @@ -13,21 +13,19 @@ @foreach (var account in Model.CurrentLogins) - { + {
@account.LoginProvider @if (ViewBag.ShowRemoveButton) { - using (Html.BeginForm("RemoveLogin", "Manage")) - { - @Html.AntiForgeryToken() +
- @Html.Hidden("loginProvider", account.LoginProvider) - @Html.Hidden("providerKey", account.ProviderKey) + +
- } +
} else { @@ -43,16 +41,14 @@ {

Add another service to log in.


- using (Html.BeginForm("LinkLogin", "Manage")) - { - @Html.AntiForgeryToken() +

@foreach (AuthenticationDescription p in Model.OtherLogins) - { + { }

- } +
} \ No newline at end of file diff --git a/src/MusicStore/Views/Manage/SetPassword.cshtml b/src/MusicStore/Views/Manage/SetPassword.cshtml index cb9824586d..a0b44b8952 100644 --- a/src/MusicStore/Views/Manage/SetPassword.cshtml +++ b/src/MusicStore/Views/Manage/SetPassword.cshtml @@ -1,31 +1,29 @@ -@model MusicStore.Models.SetPasswordViewModel +@model SetPasswordViewModel @{ - ViewBag.Title = "Create Password"; + ViewBag.Title = "Set Password"; } -

@ViewBag.Title.

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

-@using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() - -

Create Local Login

+
+

Set your password


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) + +
- @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) +
- @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + +
@@ -33,11 +31,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Manage/VerifyPhoneNumber.cshtml b/src/MusicStore/Views/Manage/VerifyPhoneNumber.cshtml index d7d1c6508f..c4f9bb94a0 100644 --- a/src/MusicStore/Views/Manage/VerifyPhoneNumber.cshtml +++ b/src/MusicStore/Views/Manage/VerifyPhoneNumber.cshtml @@ -1,14 +1,12 @@ -@model MusicStore.Models.VerifyPhoneNumberViewModel +@model VerifyPhoneNumberViewModel @{ ViewBag.Title = "Verify Phone Number"; }

@ViewBag.Title.

-@using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) -{ - @Html.AntiForgeryToken() - @Html.Hidden("phoneNumber", @Model.PhoneNumber) +
+

Enter verification code

For DEMO only: You can type in this code in the below text box to proceed: @ViewBag.Code @@ -16,11 +14,12 @@ Please change this code to register an SMS service in IdentityConfig to send a text message.


- @Html.ValidationSummary("", new { @class = "text-danger" }) +
- @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) +
- @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) + +
@@ -28,11 +27,8 @@
-} +
@section Scripts { - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jqueryval")*@ - - + @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } \ No newline at end of file diff --git a/src/MusicStore/Views/Shared/Components/Announcement/Default.cshtml b/src/MusicStore/Views/Shared/Components/Announcement/Default.cshtml index f764aaa5d0..98e5cffbe9 100644 --- a/src/MusicStore/Views/Shared/Components/Announcement/Default.cshtml +++ b/src/MusicStore/Views/Shared/Components/Announcement/Default.cshtml @@ -1,10 +1,10 @@ -@model MusicStore.Models.Album +@model Album @if (Model != null) {

  • - @Html.Label(null, "New Arrivals!", new { style = "color: red" }) - @Html.ActionLink(Model.Title, "Details", "Store", new { id = Model.AlbumId }, new { id = "NewArrivalsPanel" }) + + @Model.Title
  • } \ No newline at end of file diff --git a/src/MusicStore/Views/Shared/Components/CartSummary/Default.cshtml b/src/MusicStore/Views/Shared/Components/CartSummary/Default.cshtml index 50d6dbd769..879f48cad9 100644 --- a/src/MusicStore/Views/Shared/Components/CartSummary/Default.cshtml +++ b/src/MusicStore/Views/Shared/Components/CartSummary/Default.cshtml @@ -1,7 +1,7 @@ @if (ViewBag.CartCount > 0) {
  • - + @ViewBag.CartCount diff --git a/src/MusicStore/Views/Shared/Components/GenreMenu/Default.cshtml b/src/MusicStore/Views/Shared/Components/GenreMenu/Default.cshtml index cd9ed4491e..103404129f 100644 --- a/src/MusicStore/Views/Shared/Components/GenreMenu/Default.cshtml +++ b/src/MusicStore/Views/Shared/Components/GenreMenu/Default.cshtml @@ -1,19 +1,17 @@ -@model IEnumerable +@model IEnumerable
  • \ No newline at end of file diff --git a/src/MusicStore/Views/Shared/_Layout.cshtml b/src/MusicStore/Views/Shared/_Layout.cshtml index 6c7d262cb4..e72cb15e8e 100644 --- a/src/MusicStore/Views/Shared/_Layout.cshtml +++ b/src/MusicStore/Views/Shared/_Layout.cshtml @@ -1,15 +1,25 @@ - +@inject IOptions AppSettings + - @ViewBag.Title – MVC Music Store + @ViewBag.Title – @AppSettings.Options.SiteTitle + + + + + + + + + + + - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Styles.Render("~/Content/css") - @Scripts.Render("~/bundles/modernizr")*@ - - @@ -41,11 +51,11 @@ - @Html.ActionLink("ASP.NET MVC Music Store", "Index", "Home", null, new { @class = "navbar-brand" }) + @AppSettings.Options.SiteTitle - @*TODO : Until script helpers are available, adding script references manually*@ - @*@Scripts.Render("~/bundles/jquery") - @Scripts.Render("~/bundles/bootstrap")*@ - - + + + + + + + + + @RenderSection("scripts", required: false) \ No newline at end of file diff --git a/src/MusicStore/Views/Shared/_LoginPartial.cshtml b/src/MusicStore/Views/Shared/_LoginPartial.cshtml index a11a6b069b..3c94bc2f1d 100644 --- a/src/MusicStore/Views/Shared/_LoginPartial.cshtml +++ b/src/MusicStore/Views/Shared/_LoginPartial.cshtml @@ -2,19 +2,15 @@ @if (User.IsSignedIn()) { - using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) - { - @Html.AntiForgeryToken() - + } -//Either NTLM will be used or social authentication will be used. Based on the authentication schemes enabled remove an unused block. else if (User.Identity.IsAuthenticated) { //This code block necessary only for NTLM authentication @@ -27,7 +23,7 @@ else if (User.Identity.IsAuthenticated) else { } \ No newline at end of file diff --git a/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml b/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000000..a562dadda9 --- /dev/null +++ b/src/MusicStore/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/src/MusicStore/Views/ShoppingCart/Index.cshtml b/src/MusicStore/Views/ShoppingCart/Index.cshtml index 1a9b89c460..e1a5b785d8 100644 --- a/src/MusicStore/Views/ShoppingCart/Index.cshtml +++ b/src/MusicStore/Views/ShoppingCart/Index.cshtml @@ -55,7 +55,7 @@ Review your cart:

    - @Html.ActionLink("Checkout >>", "AddressAndPayment", "Checkout") + Checkout >>

    @@ -76,8 +76,7 @@ {
    - @Html.ActionLink(item.Album.Title, - "Details", "Store", new { id = item.AlbumId }, null) + @item.Album.Title @item.Album.Price diff --git a/src/MusicStore/Views/Store/Browse.cshtml b/src/MusicStore/Views/Store/Browse.cshtml index 6d962d0d06..9b015e759d 100644 --- a/src/MusicStore/Views/Store/Browse.cshtml +++ b/src/MusicStore/Views/Store/Browse.cshtml @@ -1,4 +1,4 @@ -@model MusicStore.Models.Genre +@model Genre @{ ViewBag.Title = "Browse Albums"; } @@ -11,7 +11,7 @@ @foreach (var album in Model.Albums) {
  • - + @if (!string.IsNullOrEmpty(album.AlbumArtUrl)) { @album.Title diff --git a/src/MusicStore/Views/Store/Details.cshtml b/src/MusicStore/Views/Store/Details.cshtml index 042f5dcd07..cdcab0ce67 100644 --- a/src/MusicStore/Views/Store/Details.cshtml +++ b/src/MusicStore/Views/Store/Details.cshtml @@ -1,4 +1,4 @@ -@model MusicStore.Models.Album +@model Album @{ ViewBag.Title = "Album - " + Model.Title; @@ -21,9 +21,9 @@

    Price: - @Html.DisplayFor(model => model.Price) +

    - @Html.ActionLink("Add to cart", "AddToCart", "ShoppingCart", new { id = Model.AlbumId }) + Add to cart

    \ No newline at end of file diff --git a/src/MusicStore/Views/Store/Index.cshtml b/src/MusicStore/Views/Store/Index.cshtml index 06f782f647..3a403089fe 100644 --- a/src/MusicStore/Views/Store/Index.cshtml +++ b/src/MusicStore/Views/Store/Index.cshtml @@ -1,4 +1,4 @@ -@model IEnumerable +@model IEnumerable @{ ViewBag.Title = "Store"; } @@ -10,6 +10,6 @@
      @foreach (var genre in Model) { -
    • @Html.ActionLink(genre.Name, "Browse", new { genre = genre.Name })
    • +
    • @genre.Name
    • }
    \ No newline at end of file diff --git a/src/MusicStore/Views/_GlobalImport.cshtml b/src/MusicStore/Views/_GlobalImport.cshtml new file mode 100644 index 0000000000..448546cc87 --- /dev/null +++ b/src/MusicStore/Views/_GlobalImport.cshtml @@ -0,0 +1,5 @@ +@using MusicStore +@using MusicStore.Models +@using Microsoft.Framework.OptionsModel +@using Microsoft.AspNet.Identity +@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" diff --git a/src/MusicStore/config.json b/src/MusicStore/config.json index 888b773ddb..b843e07e05 100644 --- a/src/MusicStore/config.json +++ b/src/MusicStore/config.json @@ -1,4 +1,7 @@ { + "AppSettings": { + "SiteTitle": "ASP.NET MVC Music Store" + }, "DefaultAdminUsername": "Administrator@test.com", "DefaultAdminPassword": "YouShouldChangeThisPassword1!", "Data": { diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index 48111c0b67..07f6b3c408 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -24,11 +24,13 @@ "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.SignalR.Server": "3.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", + "Microsoft.AspNet.Tooling.Razor": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", // For Session. "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-*", "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", diff --git a/test/E2ETests/Common/DeploymentUtility.cs b/test/E2ETests/Common/DeploymentUtility.cs index ce2ad3e1ec..1aeab11de7 100644 --- a/test/E2ETests/Common/DeploymentUtility.cs +++ b/test/E2ETests/Common/DeploymentUtility.cs @@ -419,7 +419,7 @@ namespace E2ETests } catch (Exception exception) { - logger.LogWarning("Failed to delete directory.", exception); + logger.LogWarning("Failed to delete directory : {error}", exception.Message); } } } diff --git a/test/E2ETests/Common/Helpers.cs b/test/E2ETests/Common/Helpers.cs index 95af71ba5b..913289bc81 100644 --- a/test/E2ETests/Common/Helpers.cs +++ b/test/E2ETests/Common/Helpers.cs @@ -34,11 +34,11 @@ namespace E2ETests #endif ) { - logger.LogWarning("Failed to complete the request.", exception); + logger.LogWarning("Failed to complete the request : {0}.", exception.Message); Thread.Sleep(7 * 1000); //Wait for a while before retry. } } } } } -} +} \ No newline at end of file diff --git a/test/E2ETests/Common/HtmlDOMHelper.cs b/test/E2ETests/Common/HtmlDOMHelper.cs index 126a36fb3e..b1e3398440 100644 --- a/test/E2ETests/Common/HtmlDOMHelper.cs +++ b/test/E2ETests/Common/HtmlDOMHelper.cs @@ -46,7 +46,7 @@ namespace E2ETests { foreach (XmlNode input in htmlDocument.GetElementsByTagName("input")) { - if (input.Attributes["name"].Value == "__RequestVerificationToken" && input.Attributes["type"].Value == "hidden") + if (input.Attributes["name"]?.Value == "__RequestVerificationToken" && input.Attributes["type"].Value == "hidden") { return input.Attributes["value"].Value; } diff --git a/test/E2ETests/Implementation/Scenarios.cs b/test/E2ETests/Implementation/Scenarios.cs index eb80b34800..72dd1a5ab3 100644 --- a/test/E2ETests/Implementation/Scenarios.cs +++ b/test/E2ETests/Implementation/Scenarios.cs @@ -43,7 +43,7 @@ namespace E2ETests Assert.Equal(HttpStatusCode.OK, response.StatusCode); ValidateLayoutPage(responseContent); Assert.Contains(PrefixBaseAddress("Home Page – MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); + Assert.Contains("Home Page – ASP.NET MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); if (!useNtlmAuthentication) { @@ -87,7 +87,7 @@ namespace E2ETests { Assert.Contains("ASP.NET MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains(PrefixBaseAddress("
  • Home
  • "), responseContent, StringComparison.OrdinalIgnoreCase); - Assert.Contains(PrefixBaseAddress("Store "), responseContent, StringComparison.OrdinalIgnoreCase); + Assert.Contains(PrefixBaseAddress("Store "), responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("
      ", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("
    • ", responseContent, StringComparison.OrdinalIgnoreCase); } @@ -99,7 +99,7 @@ namespace E2ETests ThrowIfResponseStatusNotOk(response); var responseContent = response.Content.ReadAsStringAsync().Result; ValidateLayoutPage(responseContent); - Assert.Contains("Log in – MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); + Assert.Contains("Log in – ASP.NET MVC Music Store", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("

      Use a local account to log in.

      ", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Equal(_applicationBaseUrl + PrefixBaseAddress("Account/Login?ReturnUrl=%2F{0}%2FAdmin%2FStoreManager%2F"), response.RequestMessage.RequestUri.AbsoluteUri); _logger.LogInformation("Redirected to login page as expected."); @@ -137,7 +137,7 @@ namespace E2ETests response = _httpClient.PostAsync("Account/Register", content).Result; responseContent = response.Content.ReadAsStringAsync().Result; Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application")); - Assert.Contains("
      • The password and confirmation password do not match.
      • ", responseContent, StringComparison.OrdinalIgnoreCase); + Assert.Contains("
        • The password and confirmation password do not match.
        • ", responseContent, StringComparison.OrdinalIgnoreCase); _logger.LogInformation("Server side model validator rejected the user '{email}''s registration as passwords do not match.", generatedEmail); } @@ -249,7 +249,7 @@ namespace E2ETests var content = new FormUrlEncodedContent(formParameters.ToArray()); response = _httpClient.PostAsync("Account/Login", content).Result; responseContent = response.Content.ReadAsStringAsync().Result; - Assert.Contains("
          • Invalid login attempt.
          • ", responseContent, StringComparison.OrdinalIgnoreCase); + Assert.Contains("
            • Invalid login attempt.
            • ", responseContent, StringComparison.OrdinalIgnoreCase); //Verify cookie not sent Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application")); _logger.LogInformation("Identity successfully prevented an invalid user login."); diff --git a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs index 6e06939bdc..ac71431752 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs @@ -31,6 +31,8 @@ namespace MusicStore public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSubKey("AppSettings")); + //Sql client not available on mono var useInMemoryStore = Type.GetType("Mono.Runtime") != null; diff --git a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs index cdb07ef61d..a7a0b0cda8 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs @@ -39,6 +39,8 @@ namespace MusicStore public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSubKey("AppSettings")); + //Sql client not available on mono string value; var useInMemoryStore = Configuration.TryGet("UseInMemoryStore", out value) && value == "true" ?