fixes test

This commit is contained in:
Shannon
2017-04-19 16:09:59 +10:00
parent d5a71ec1da
commit b499b45a5c
2 changed files with 6 additions and 3 deletions

View File

@@ -521,7 +521,9 @@ namespace Umbraco.Core.Security
public override string ResetPassword(string username, string answer)
{
var canReset = this.CanResetPassword(ApplicationContext.Current.Services.UserService);
var userService = ApplicationContext.Current == null ? null : ApplicationContext.Current.Services.UserService;
var canReset = this.CanResetPassword(userService);
if (canReset == false)
{

View File

@@ -26,10 +26,11 @@ namespace Umbraco.Core.Security
internal static bool CanResetPassword(this MembershipProvider provider, IUserService userService)
{
if (provider == null) throw new ArgumentNullException("provider");
if (userService == null) throw new ArgumentNullException("userService");
var canReset = provider.EnablePasswordReset;
if (userService == null) return canReset;
//we need to check for the special case in which a user is an admin - in which acse they can reset the password even if EnablePasswordReset == false
if (provider.EnablePasswordReset == false)
{