refactor: remove unused backend extensions
This commit is contained in:
@@ -25,7 +25,6 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
private readonly SysUserService _sysUserService;
|
||||
private readonly SysTenantService _sysTenantService;
|
||||
private readonly SysSmsService _sysSmsService;
|
||||
private readonly SysLdapService _sysLdapService;
|
||||
private readonly ICaptcha _captcha;
|
||||
private readonly IEventPublisher _eventPublisher;
|
||||
private readonly SysCacheService _sysCacheService;
|
||||
@@ -35,7 +34,6 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
SysOnlineUserService sysOnlineUserService,
|
||||
SysConfigService sysConfigService,
|
||||
SysLdapService sysLdapService,
|
||||
IEventPublisher eventPublisher,
|
||||
SysSmsService sysSmsService,
|
||||
SysCacheService sysCacheService,
|
||||
@@ -57,7 +55,6 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
_sysConfigService = sysConfigService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_sysOnlineUserService = sysOnlineUserService;
|
||||
_sysLdapService = sysLdapService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,23 +83,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
|
||||
// 账号是否被冻结
|
||||
if (user.Status == StatusEnum.Disable) throw Oops.Oh(ErrorCodeEnum.D1017);
|
||||
|
||||
// 是否开启域登录验证
|
||||
if (await _sysConfigService.GetConfigValue<bool>(ConfigConst.SysDomainLogin))
|
||||
{
|
||||
var userLdap = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserLdap>>().GetFirstAsync(u => u.UserId == user.Id && u.TenantId == tenant.Id);
|
||||
if (userLdap == null)
|
||||
{
|
||||
VerifyPassword(input.Password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
}
|
||||
else if (!await App.GetRequiredService<SysLdapService>().AuthAccount(tenant.Id, userLdap.Account, CryptogramUtil.Decrypt(input.Password)))
|
||||
{
|
||||
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));
|
||||
throw Oops.Oh(ErrorCodeEnum.D1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
VerifyPassword(input.Password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
VerifyPassword(input.Password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
|
||||
// 登录成功则清空密码错误次数
|
||||
_sysCacheService.Remove(keyPasswordErrorTimes);
|
||||
@@ -184,23 +165,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
|
||||
var keyPasswordErrorTimes = $"{CacheConst.KeyPasswordErrorTimes}{user.Account}";
|
||||
var passwordErrorTimes = _sysCacheService.Get<int>(keyPasswordErrorTimes);
|
||||
|
||||
// 是否开启域登录验证
|
||||
if (await _sysConfigService.GetConfigValue<bool>(ConfigConst.SysDomainLogin))
|
||||
{
|
||||
var userLdap = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserLdap>>().GetFirstAsync(u => u.UserId == user.Id && u.TenantId == user.TenantId);
|
||||
if (userLdap == null)
|
||||
{
|
||||
VerifyPassword(password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
}
|
||||
else if (!await _sysLdapService.AuthAccount(user.TenantId!.Value, userLdap.Account, CryptogramUtil.Decrypt(password)))
|
||||
{
|
||||
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));
|
||||
throw Oops.Oh(ErrorCodeEnum.D1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
VerifyPassword(password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
VerifyPassword(password, keyPasswordErrorTimes, passwordErrorTimes, user);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user