限制链接登陆一次
parent
ae1137d2af
commit
458ca443fd
|
@ -2354,6 +2354,13 @@
|
||||||
<member name="M:IRaCIS.Application.Services.UserService.SendVerificationCode(System.String)">
|
<member name="M:IRaCIS.Application.Services.UserService.SendVerificationCode(System.String)">
|
||||||
<summary>发送验证码 修改邮箱(已经登陆修改) New </summary>
|
<summary>发送验证码 修改邮箱(已经登陆修改) New </summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.UserService.VerifyCanInitSetUserNameAndPwd(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
Result 为true 的时候 允许提交设置
|
||||||
|
</summary>
|
||||||
|
<param name="userId"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.UserService.ResetPassword(System.Guid)">
|
<member name="M:IRaCIS.Application.Services.UserService.ResetPassword(System.Guid)">
|
||||||
<summary>
|
<summary>
|
||||||
重置密码为 默认密码
|
重置密码为 默认密码
|
||||||
|
|
|
@ -278,6 +278,8 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||||
|
|
||||||
|
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||||
|
|
||||||
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&access_token=" + token;
|
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&access_token=" + token;
|
||||||
|
|
||||||
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
||||||
|
@ -369,6 +371,11 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||||
|
|
||||||
|
if (sysUserInfo.IsFirstAdd)
|
||||||
|
{
|
||||||
|
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var pathToFile = _hostEnvironment.WebRootPath
|
var pathToFile = _hostEnvironment.WebRootPath
|
||||||
+ Path.DirectorySeparatorChar.ToString()
|
+ Path.DirectorySeparatorChar.ToString()
|
||||||
|
@ -421,6 +428,10 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||||
|
if (sysUserInfo.IsFirstAdd)
|
||||||
|
{
|
||||||
|
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||||
|
}
|
||||||
|
|
||||||
var pathToFile = _hostEnvironment.WebRootPath
|
var pathToFile = _hostEnvironment.WebRootPath
|
||||||
+ Path.DirectorySeparatorChar.ToString()
|
+ Path.DirectorySeparatorChar.ToString()
|
||||||
|
|
|
@ -199,17 +199,30 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Ok();
|
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]
|
[HttpGet]
|
||||||
public async Task<IResponseOutput> InitSetUserNameAndPwd(Guid userId, string newUserName, string newPWd)
|
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 VerifyUserNameAsync(userId, newUserName);
|
||||||
|
|
||||||
await _userRepository.UpdatePartialFromQueryAsync(userId, u => new User()
|
await _userRepository.UpdatePartialFromQueryAsync(userId, u => new User()
|
||||||
|
@ -220,6 +233,8 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
IsFirstAdd = false,
|
IsFirstAdd = false,
|
||||||
|
|
||||||
|
EmailToken = String.Empty
|
||||||
|
|
||||||
}, true) ;
|
}, true) ;
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
|
@ -69,6 +69,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public bool IsFirstAdd { get; set; } = true;
|
public bool IsFirstAdd { get; set; } = true;
|
||||||
|
|
||||||
|
public string EmailToken { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Projectable] public string FullName => LastName + " / " + FirstName;
|
[Projectable] public string FullName => LastName + " / " + FirstName;
|
||||||
|
|
||||||
//[Projectable] public string FullName => $"{LastName} / {FirstName}";
|
//[Projectable] public string FullName => $"{LastName} / {FirstName}";
|
||||||
|
|
Loading…
Reference in New Issue