mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Support for ReturnUrl on register page
This commit is contained in:
@@ -122,7 +122,7 @@ namespace Orchard.Users.Controllers {
|
||||
[HttpPost]
|
||||
[AlwaysAccessible]
|
||||
[ValidateInput(false)]
|
||||
public ActionResult Register(string userName, string email, string password, string confirmPassword) {
|
||||
public ActionResult Register(string userName, string email, string password, string confirmPassword, string returnUrl = null) {
|
||||
// ensure users can register
|
||||
var registrationSettings = _orchardServices.WorkContext.CurrentSite.As<RegistrationSettingsPart>();
|
||||
if ( !registrationSettings.UsersCanRegister ) {
|
||||
@@ -154,7 +154,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
_authenticationService.SignIn(user, false /* createPersistentCookie */);
|
||||
return Redirect("~/");
|
||||
return this.RedirectLocal(returnUrl);
|
||||
}
|
||||
|
||||
ModelState.AddModelError("_FORM", T(ErrorCodeToString(/*createStatus*/MembershipCreateStatus.ProviderError)));
|
||||
@@ -198,7 +198,7 @@ namespace Orchard.Users.Controllers {
|
||||
_userService.SendLostPasswordEmail(username, nonce => Url.MakeAbsolute(Url.Action("LostPassword", "Account", new { Area = "Orchard.Users", nonce = nonce }), siteUrl));
|
||||
|
||||
_orchardServices.Notifier.Information(T("Check your e-mail for the confirmation link."));
|
||||
|
||||
|
||||
return RedirectToAction("LogOn");
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<h1 class="page-title">@Html.TitleForPage((string)Model.Title)</h1>
|
||||
<p>
|
||||
@T("Please enter your username and password.")
|
||||
@if(userCanRegister) { @Html.ActionLink(T("Register").Text, "Register") @T(" if you don't have an account.") }
|
||||
@if(userCanRegister) { @Html.ActionLink(T("Register").Text, "Register", new { ReturnUrl = Request.QueryString["ReturnUrl"] }) @T(" if you don't have an account.") }
|
||||
@if(enableLostPassword) { <text> </text> @Html.ActionLink(T("Lost your Password?").Text, "RequestLostPassword") }
|
||||
</p>
|
||||
@Html.ValidationSummary(T("Login was unsuccessful. Please correct the errors and try again.").ToString())
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<p>@T("Use the form below to create a new account.")</p>
|
||||
<p>@T("Passwords are required to be a minimum of {0} characters in length.", ViewData["PasswordLength"])</p>
|
||||
@Html.ValidationSummary(T("Account creation was unsuccessful. Please correct the errors and try again.").ToString())
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Register", new { ReturnUrl = Request.QueryString["ReturnUrl"] }))) {
|
||||
<fieldset>
|
||||
<legend>@T("Account Information")</legend>
|
||||
<div>
|
||||
|
Reference in New Issue
Block a user