链接点击一次后端跳转

This commit is contained in:
2022-05-30 11:28:01 +08:00
parent 144f53e809
commit a261605bde
7 changed files with 49 additions and 37 deletions
@@ -159,7 +159,7 @@ namespace IRaCIS.Application.Contracts
public class UserCommand : UserInfo
{
public string BaseUrl { get; set; } = string.Empty;
public string RouteUrl { get; set; } = string.Empty;
//public string FirstName { get; set; }
@@ -199,26 +199,23 @@ 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 && t.IsFirstAdd));
}
///// <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 && t.IsFirstAdd));
//}
[HttpGet]
public async Task<IResponseOutput> InitSetUserNameAndPwd(Guid userId, string newUserName, string newPWd)
{
if (!await _userRepository.AnyAsync(t => t.Id == userId && t.EmailToken==_userInfo.UserToken && t.IsFirstAdd))
{
return ResponseOutput.NotOk("您的初始化链接已过期");
}
await VerifyUserPwdAsync(userId, newPWd);
@@ -489,7 +486,7 @@ namespace IRaCIS.Application.Services
var success = await _userRepository.SaveChangesAsync();
await _mailVerificationService.AddUserSendEmailAsync(saveItem.Id, userAddModel.RouteUrl);
await _mailVerificationService.AddUserSendEmailAsync(saveItem.Id, userAddModel.BaseUrl, userAddModel.RouteUrl);
return ResponseOutput.Result(success, new UserAddedReturnDTO { Id = saveItem.Id, UserCode = saveItem.UserCode });