From e9211c6ace2cfb60dcde7d731b112bd150b0815f Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Tue, 18 Aug 2020 21:06:08 -0400 Subject: [PATCH] Formatting for new users --- WebCms/Controllers/MembershipController.cs | 5 +++-- WebCms/Views/LeafInput/Create.cshtml | 14 +++++++++++-- .../MacroPartials/Membership/Login.cshtml | 2 +- .../MacroPartials/Membership/Register.cshtml | 4 ++-- WebCms/Views/Master.cshtml | 2 +- .../EditorTemplates/_FieldLayout.cshtml | 21 ++++++++++++++++--- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/WebCms/Controllers/MembershipController.cs b/WebCms/Controllers/MembershipController.cs index 600a11f..c2354fc 100644 --- a/WebCms/Controllers/MembershipController.cs +++ b/WebCms/Controllers/MembershipController.cs @@ -21,8 +21,7 @@ namespace LeafWeb.WebCms.Controllers if (member == null) { - - TempData["StatusMessage"] = $"Sorry, verification was not found. Please try to register again, or use Contact Us to resolve the issue."; + TempData["StatusMessage"] = "Sorry, verification was not found. Please try to register again, or use Contact Us to resolve the issue."; TempData["StatusMessage-Type"] = "alert-danger"; } else if (member.IsApproved) @@ -57,6 +56,8 @@ namespace LeafWeb.WebCms.Controllers $"Thank you! Your email is now verified at {member.Email}, use your password to login."; TempData["StatusMessage-Type"] = "alert-success"; + logger.InfoFormat($"User {member.Email} verified."); + redirectUrl = "membership/login"; } } diff --git a/WebCms/Views/LeafInput/Create.cshtml b/WebCms/Views/LeafInput/Create.cshtml index d4bb61f..370e593 100644 --- a/WebCms/Views/LeafInput/Create.cshtml +++ b/WebCms/Views/LeafInput/Create.cshtml @@ -13,7 +13,18 @@ var user = Membership.GetUser(); } - +@if (user == null) +{ +
+ +
+}
@@ -63,7 +74,6 @@
- @using (Html.BeginUmbracoForm("Submit", null, new { id = "create" })) { @Html.EditorFor(m => m.PhotosynthesisType) diff --git a/WebCms/Views/MacroPartials/Membership/Login.cshtml b/WebCms/Views/MacroPartials/Membership/Login.cshtml index 92dff94..1e90631 100644 --- a/WebCms/Views/MacroPartials/Membership/Login.cshtml +++ b/WebCms/Views/MacroPartials/Membership/Login.cshtml @@ -12,7 +12,7 @@
@using (Html.BeginUmbracoForm("HandleLogin")) { - @Html.EditorFor(m => loginModel.Username) + @Html.EditorFor(m => loginModel.Username, new {labelText = "Email"}) @Html.EditorFor(m => loginModel.Password, "PasswordWithForgotLink") @Html.ValidationSummary("loginModel", true) diff --git a/WebCms/Views/MacroPartials/Membership/Register.cshtml b/WebCms/Views/MacroPartials/Membership/Register.cshtml index 0a84382..a7b41c5 100644 --- a/WebCms/Views/MacroPartials/Membership/Register.cshtml +++ b/WebCms/Views/MacroPartials/Membership/Register.cshtml @@ -42,11 +42,11 @@ else { @Html.ValidationSummary(false) - @Html.EditorFor(m => registerModel.Name) + @Html.EditorFor(m => registerModel.Name, new {labelText = "User Email"}) @Html.EditorFor(m => registerModel.Email, new { type = "email"}) @Html.EditorFor(m => registerModel.Password, "Password")
- @Html.Label("VerifyPassword") + @Html.Label("Verify Password") @Html.Password("VerifyPassword", null, new { @class = "form-control" }) @Html.ValidationMessage("VerifyPassword", "", new { @class = "text-danger" })
diff --git a/WebCms/Views/Master.cshtml b/WebCms/Views/Master.cshtml index 9b0929e..5edb7e9 100644 --- a/WebCms/Views/Master.cshtml +++ b/WebCms/Views/Master.cshtml @@ -83,7 +83,7 @@
-
+
@Html.Partial("_StatusMessage") @RenderBody() diff --git a/WebCms/Views/Shared/EditorTemplates/_FieldLayout.cshtml b/WebCms/Views/Shared/EditorTemplates/_FieldLayout.cshtml index d6fb80a..e40d0ff 100644 --- a/WebCms/Views/Shared/EditorTemplates/_FieldLayout.cshtml +++ b/WebCms/Views/Shared/EditorTemplates/_FieldLayout.cshtml @@ -10,9 +10,24 @@ { groupClass = string.Concat(groupClass, " ", ViewBag.groupClass); } + + var labelText = string.Empty; + + if (ViewBag.labelText != null) + { + labelText = ViewBag.labelText; + } }
- @Html.LabelForModel() + @if (!string.IsNullOrEmpty(labelText)) + { + @Html.LabelForModel(labelText) + } + else + { + @Html.LabelForModel() + } + @RenderBody() - @Html.ValidationMessage(string.Empty, new { @class = "text-danger"}) -
+ @Html.ValidationMessage(string.Empty, new { @class = "text-danger" }) +
\ No newline at end of file