Commit 51e9dcf7 by ruyun.zhang

登录错误描述修改

parent 1dcd666a
...@@ -67,7 +67,7 @@ public ApiResponse<JwtToken> Login([FromBody] LoginRequest request) ...@@ -67,7 +67,7 @@ public ApiResponse<JwtToken> Login([FromBody] LoginRequest request)
{ {
var user = _userService.Login(request); var user = _userService.Login(request);
if (user == null) if (user == null)
return new ApiResponse<JwtToken>(ResponseType.Fail, "用户不存在"); return new ApiResponse<JwtToken>(ResponseType.Fail, "用户或密码错误");
var claims = new List<Claim> var claims = new List<Claim>
{ {
......
...@@ -47,7 +47,7 @@ public List<RoleResponse> GetUserRole(int userid) ...@@ -47,7 +47,7 @@ public List<RoleResponse> GetUserRole(int userid)
public List<sys_role> GetRole(int userid) public List<sys_role> GetRole(int userid)
{ {
if (userid <= 0) if (userid <= 0)
throw new PerformanceException($"userid:{userid} 错误"); throw new PerformanceException($"用户或密码错误");
var joinList = _userroleRepository.GetEntities(t => t.UserID == userid); var joinList = _userroleRepository.GetEntities(t => t.UserID == userid);
if (joinList == null && joinList.Count == 0) if (joinList == null && joinList.Count == 0)
......
...@@ -69,18 +69,18 @@ public UserIdentity Login(LoginRequest request) ...@@ -69,18 +69,18 @@ public UserIdentity Login(LoginRequest request)
{ {
var user = _userRepository.GetEntity(t => t.Login == request.Account && t.IsDelete == 1); var user = _userRepository.GetEntity(t => t.Login == request.Account && t.IsDelete == 1);
if (user == null) if (user == null)
throw new PerformanceException($"{request.Account}”用户不存在"); throw new PerformanceException($"用户或密码错误");
//MD5小写加密 //MD5小写加密
request.Password = PwdHelper.MD5AndSalt(request.Password); request.Password = PwdHelper.MD5AndSalt(request.Password);
if (!user.Password.Equals(request.Password, StringComparison.OrdinalIgnoreCase)) if (!user.Password.Equals(request.Password, StringComparison.OrdinalIgnoreCase))
throw new PerformanceException($"密码错误"); throw new PerformanceException($"用户或密码错误");
var data = _mapper.Map<UserIdentity>(user); var data = _mapper.Map<UserIdentity>(user);
data.Token = Guid.NewGuid().ToString("N"); data.Token = Guid.NewGuid().ToString("N");
return data; return data;
} }
throw new PerformanceException($"登录类型LoginType:{request.LoginType}暂不支持"); throw new PerformanceException($"用户或密码错误");
} }
public UserIdentity GetUser(int userId) public UserIdentity GetUser(int userId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment