Refactoring users challenge emails

- Adding unit tests
- Creating a stub for email messages
- Adding tenant's name to nonces in order to prevent cross-tenants substitution

--HG--
branch : dev
This commit is contained in:
Sébastien Ros
2010-11-28 18:34:13 -08:00
parent a376b7b40b
commit e2adccc598
11 changed files with 493 additions and 18 deletions

View File

@@ -120,8 +120,7 @@ namespace Orchard.Users.Controllers {
if (user != null) {
if ( user.As<UserPart>().EmailStatus == UserStatus.Pending ) {
string challengeToken = _userService.GetNonce(user.As<UserPart>());
_userService.SendChallengeEmail(user.As<UserPart>(), Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new { Area = "Orchard.Users", token = challengeToken })));
_userService.SendChallengeEmail(user.As<UserPart>(), nonce => Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new { Area = "Orchard.Users", nonce = nonce })));
return RedirectToAction("ChallengeEmailSent");
}

View File

@@ -197,8 +197,7 @@ namespace Orchard.Users.Controllers {
var user = Services.ContentManager.Get(id);
if ( user != null ) {
string challengeToken = _userService.GetNonce(user.As<UserPart>());
_userService.SendChallengeEmail(user.As<UserPart>(), Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new {Area = "Orchard.Users", token = challengeToken})));
_userService.SendChallengeEmail(user.As<UserPart>(), nonce => Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new {Area = "Orchard.Users", nonce = nonce})));
}
Services.Notifier.Information(T("Challenge email sent"));