#18357: Using BaseUrl in validation emails if available

Work Item: 18357

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-01-13 16:38:39 -08:00
parent e314ff298d
commit 918d05352d

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Web;
using Orchard.Core.Settings.Models;
using Orchard.Localization; using Orchard.Localization;
using System.Security.Principal; using System.Security.Principal;
using System.Web.Mvc; using System.Web.Mvc;
@@ -16,6 +18,7 @@ using Orchard.Users.Models;
using Orchard.UI.Notify; using Orchard.UI.Notify;
using Orchard.Users.Events; using Orchard.Users.Events;
using System.Collections.Generic; using System.Collections.Generic;
using Orchard.Utility.Extensions;
namespace Orchard.Users.Controllers { namespace Orchard.Users.Controllers {
[HandleError, Themed] [HandleError, Themed]
@@ -137,7 +140,12 @@ namespace Orchard.Users.Controllers {
if (user != null) { if (user != null) {
if ( user.As<UserPart>().EmailStatus == UserStatus.Pending ) { if ( user.As<UserPart>().EmailStatus == UserStatus.Pending ) {
_userService.SendChallengeEmail(user.As<UserPart>(), nonce => Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new { Area = "Orchard.Users", nonce = nonce }))); var siteUrl = _orchardServices.WorkContext.CurrentSite.As<SiteSettings2Part>().BaseUrl;
if(String.IsNullOrWhiteSpace(siteUrl)) {
siteUrl = HttpContext.Request.ToRootUrlString();
}
_userService.SendChallengeEmail(user.As<UserPart>(), nonce => VirtualPathUtility.Combine(siteUrl, Url.Action("ChallengeEmail", "Account", new { Area = "Orchard.Users", nonce = nonce })));
foreach (var userEventHandler in _userEventHandlers) { foreach (var userEventHandler in _userEventHandlers) {
userEventHandler.SentChallengeEmail(user); userEventHandler.SentChallengeEmail(user);