限制链接登陆一次
This commit is contained in:
@@ -199,17 +199,30 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Result 为true 的时候 允许提交设置
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IResponseOutput> VerifyCanInitSetUserNameAndPwd(Guid userId)
|
||||
{
|
||||
return ResponseOutput.Ok(await _userRepository.AnyAsync(t => t.Id == userId && t.EmailToken == _userInfo.UserToken));
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IResponseOutput> InitSetUserNameAndPwd(Guid userId, string newUserName, string newPWd)
|
||||
{
|
||||
|
||||
await VerifyUserPwdAsync(userId, newPWd);
|
||||
if (!await _userRepository.AnyAsync(t => t.Id == userId && t.EmailToken==_userInfo.UserToken))
|
||||
{
|
||||
return ResponseOutput.NotOk("您的初始化链接已过期");
|
||||
}
|
||||
|
||||
|
||||
await VerifyUserPwdAsync(userId, newPWd);
|
||||
|
||||
await VerifyUserNameAsync(userId, newUserName);
|
||||
|
||||
await _userRepository.UpdatePartialFromQueryAsync(userId, u => new User()
|
||||
@@ -220,7 +233,9 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
IsFirstAdd = false,
|
||||
|
||||
}, true);
|
||||
EmailToken = String.Empty
|
||||
|
||||
}, true) ;
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user