This commit is contained in:
@@ -334,14 +334,21 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
////查找改邮箱或者手机的用户
|
||||
var exist = await _identityUserRepository.AnyAsync(t => t.EMail == email && t.Status == UserStateEnum.Enable);
|
||||
var existUser = await _identityUserRepository.Where(t => t.EMail == email && t.Status == UserStateEnum.Enable).FirstOrDefaultAsync();
|
||||
|
||||
if (!exist)
|
||||
if (existUser==null)
|
||||
{
|
||||
//---邮箱错误。
|
||||
return ResponseOutput.NotOk(_localizer["User_EmailError"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (existUser.IsFirstAdd && existUser.UserName.IsNullOrEmpty())
|
||||
{
|
||||
return ResponseOutput.NotOk(_localizer["User_Notinitialized"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//验证码 6位
|
||||
@@ -937,7 +944,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var userLoginReturnModel = new IRCLoginReturnDTO();
|
||||
|
||||
|
||||
var loginUser = await _identityUserRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo<UserBasicInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
var loginUser = await _identityUserRepository.Where(u => (u.UserName.Equals(userName) || u.EMail.Equals(userName)) && u.Password == password).ProjectTo<UserBasicInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
var existUserLoginInfo = await _identityUserRepository.Where(u => u.UserName == userName).Select(t => new { t.LastLoginIP, t.LastChangePassWordTime, t.Id }).FirstOrDefaultAsync();
|
||||
|
||||
@@ -1013,13 +1020,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.IdentityUserId, x => new IdentityUser()
|
||||
{
|
||||
LastLoginTime = DateTime.Now,
|
||||
LastLoginIP=_userInfo.IP,
|
||||
LastLoginIP = _userInfo.IP,
|
||||
});
|
||||
|
||||
|
||||
if (loginUser.Status == 0)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = userName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||
|
||||
//---该用户已经被禁用。
|
||||
return ResponseOutput.NotOk(_localizer["User_Disabled"], new IRCLoginReturnDTO());
|
||||
@@ -1029,7 +1036,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _fusionCache.SetAsync(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes));
|
||||
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, OptType = UserOptType.Login, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName=loginUser.UserName, OptType = UserOptType.Login, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||
|
||||
userLoginReturnModel.BasicInfo = loginUser;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user