Skip to content

Commit 1c468e2

Browse files
authored
Implement IsLockedOut on base class instead (#17979)
1 parent 1347074 commit 1c468e2

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,31 @@ public override async Task<IdentityResult> AccessFailedAsync(TUser user)
246246
return result;
247247
}
248248

249+
/// <summary>
250+
/// Override to check the user approval value as well as the user lock out date, by default this only checks the user's
251+
/// locked out date
252+
/// </summary>
253+
/// <param name="user">The user</param>
254+
/// <returns>True if the user is locked out, else false</returns>
255+
/// <remarks>
256+
/// In the ASP.NET Identity world, there is only one value for being locked out, in Umbraco we have 2 so when checking
257+
/// this for Umbraco we need to check both values
258+
/// </remarks>
259+
public override async Task<bool> IsLockedOutAsync(TUser user)
260+
{
261+
if (user == null)
262+
{
263+
throw new ArgumentNullException(nameof(user));
264+
}
265+
266+
if (user.IsApproved == false)
267+
{
268+
return true;
269+
}
270+
271+
return await base.IsLockedOutAsync(user);
272+
}
273+
249274
public async Task<bool> ValidateCredentialsAsync(string username, string password)
250275
{
251276
TUser? user = await FindByNameAsync(username);

src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,6 @@ public BackOfficeUserManager(
6262
_globalSettings = globalSettings.Value;
6363
}
6464

65-
/// <summary>
66-
/// Override to check the user approval value as well as the user lock out date, by default this only checks the user's
67-
/// locked out date
68-
/// </summary>
69-
/// <param name="user">The user</param>
70-
/// <returns>True if the user is locked out, else false</returns>
71-
/// <remarks>
72-
/// In the ASP.NET Identity world, there is only one value for being locked out, in Umbraco we have 2 so when checking
73-
/// this for Umbraco we need to check both values
74-
/// </remarks>
75-
public override async Task<bool> IsLockedOutAsync(BackOfficeIdentityUser user)
76-
{
77-
if (user == null)
78-
{
79-
throw new ArgumentNullException(nameof(user));
80-
}
81-
82-
if (user.IsApproved == false)
83-
{
84-
return true;
85-
}
86-
87-
return await base.IsLockedOutAsync(user);
88-
}
89-
9065
public override async Task<IdentityResult> AccessFailedAsync(BackOfficeIdentityUser user)
9166
{
9267
IdentityResult result = await base.AccessFailedAsync(user);

0 commit comments

Comments
 (0)