diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
index 2daddd527c..9d717f7d42 100644
--- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
+++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
@@ -35,7 +35,7 @@
if (success)
{
// This message will show if RedirectOnSucces is set to false (default)
-
Profile updated
+ Profile updated
}
using (Html.BeginUmbracoForm("HandleUpdateProfile"))
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml
index f14525bb5c..ed1e0915d4 100644
--- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml
+++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml
@@ -8,30 +8,32 @@
@{
- /*You can specify a custom member type alias in the constructor, the default is 'Member'
+ /*
+ * You can specify a custom member type alias in the constructor, the default is 'Member'
* for example, to use 'Custom Member' you'd use this syntax:
+ *
* var registerModel = Members.CreateRegistrationModel("Custom Member");
+
*/
var registerModel = Members.CreateRegistrationModel();
- @*
- Configurable here:
-
- registerModel.RedirectOnSucces - the default is false
-
- registerModel.RedirectUrl - what page do we go to if the registration was successful?
- the default is "/" unless RedirectOnSuccess is set to false
-
- registerModel.UsernameIsEmail - the default is true
- if you want the username to be different from the email
- address, set this to true and add a new Username field in
- the form below
-
- @Html.LabelFor(m => registerModel.Username)
- @Html.TextBoxFor(m => registerModel.Username)
- @Html.ValidationMessageFor(m => registerModel.Username)
- *@
+ /*
+ * Configurable here:
+ *
+ * registerModel.RedirectUrl - Optional. What path to redirect to if registration is successful.
+ * By default the member will be redirected to the current umbraco page
+ * unless this is specified.
+ *
+ * registerModel.UsernameIsEmail - the default is true
+ * if you want the username to be different from the email
+ * address, set this to true and add a new Username field in
+ * the form below
+ *
+ * @Html.LabelFor(m => registerModel.Username)
+ * @Html.TextBoxFor(m => registerModel.Username)
+ * @Html.ValidationMessageFor(m => registerModel.Username)
+ */
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
@@ -48,7 +50,7 @@
@if (success)
{
// This message will show if RedirectOnSucces is set to false (default)
- Registration succeeeded.
+ Registration succeeeded.
}
else
{
@@ -85,7 +87,6 @@ else
}
@Html.HiddenFor(m => registerModel.MemberTypeAlias)
- @Html.HiddenFor(m => registerModel.RedirectOnSucces)
@Html.HiddenFor(m => registerModel.RedirectUrl)
@Html.HiddenFor(m => registerModel.UsernameIsEmail)
diff --git a/src/Umbraco.Web/Controllers/UmbProfileController.cs b/src/Umbraco.Web/Controllers/UmbProfileController.cs
index 1f6e10e249..af647215ac 100644
--- a/src/Umbraco.Web/Controllers/UmbProfileController.cs
+++ b/src/Umbraco.Web/Controllers/UmbProfileController.cs
@@ -7,6 +7,7 @@ using umbraco.cms.businesslogic.member;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Core.Security;
+using Umbraco.Core;
namespace Umbraco.Web.Controllers
{
@@ -32,11 +33,15 @@ namespace Umbraco.Web.Controllers
return CurrentUmbracoPage();
}
+ //if there is a specified path to redirect to then use it
+ if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
+ {
+ return Redirect(model.RedirectUrl);
+ }
+
+ //redirect to current page by default
TempData.Add("ProfileUpdateSuccess", true);
-
- //TODO: Why are we redirecting to home again here??
- return Redirect("/");
-
+ return RedirectToCurrentUmbracoPage();
}
}
}
diff --git a/src/Umbraco.Web/Controllers/UmbRegisterController.cs b/src/Umbraco.Web/Controllers/UmbRegisterController.cs
index 8cc7722037..3dad27a13d 100644
--- a/src/Umbraco.Web/Controllers/UmbRegisterController.cs
+++ b/src/Umbraco.Web/Controllers/UmbRegisterController.cs
@@ -4,6 +4,7 @@ using System.Web.Mvc;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.member;
+using Umbraco.Core;
using Umbraco.Core.Security;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
@@ -26,10 +27,12 @@ namespace Umbraco.Web.Controllers
switch (status)
{
case MembershipCreateStatus.Success:
- if (model.RedirectOnSucces)
+ //if there is a specified path to redirect to then use it
+ if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
{
return Redirect(model.RedirectUrl);
}
+ //redirect to current page by default
TempData.Add("FormSuccess", true);
return RedirectToCurrentUmbracoPage();
case MembershipCreateStatus.InvalidUserName:
diff --git a/src/Umbraco.Web/Models/ProfileModel.cs b/src/Umbraco.Web/Models/ProfileModel.cs
index 84742c922a..5aa014510c 100644
--- a/src/Umbraco.Web/Models/ProfileModel.cs
+++ b/src/Umbraco.Web/Models/ProfileModel.cs
@@ -59,5 +59,11 @@ namespace Umbraco.Web.Models
/// Adding items to this list on the front-end will not add properties to the member in the database.
///
public List MemberProperties { get; set; }
+
+ ///
+ /// The path to redirect to when update is successful, if not specified then the user will be
+ /// redirected to the current Umbraco page
+ ///
+ public string RedirectUrl { get; set; }
}
}
diff --git a/src/Umbraco.Web/Models/RegisterModel.cs b/src/Umbraco.Web/Models/RegisterModel.cs
index 21a3c56a4b..ac89609347 100644
--- a/src/Umbraco.Web/Models/RegisterModel.cs
+++ b/src/Umbraco.Web/Models/RegisterModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
@@ -54,15 +55,30 @@ namespace Umbraco.Web.Models
///
public List MemberProperties { get; set; }
+ ///
+ /// The member type alias to use to register the member
+ ///
public string MemberTypeAlias { get; set; }
+ ///
+ /// The members real name
+ ///
public string Name { get; set; }
+ ///
+ /// The members password
+ ///
[Required]
public string Password { get; set; }
+ [ReadOnly(true)]
+ [Obsolete("This is no longer used and will be removed from the codebase in future versions")]
public bool RedirectOnSucces { get; set; }
+ ///
+ /// The path to redirect to when registration is successful, if not specified then the user will be
+ /// redirected to the current Umbraco page
+ ///
public string RedirectUrl { get; set; }
///