|
@@ -34,7 +34,7 @@ namespace MTWorkHR.Identity.Services
|
|
var result = await _signInManager.CheckPasswordSignInAsync(user, request.Password, false);
|
|
var result = await _signInManager.CheckPasswordSignInAsync(user, request.Password, false);
|
|
if(!result.Succeeded)
|
|
if(!result.Succeeded)
|
|
{
|
|
{
|
|
- throw new BadRequest($"Credentials for '{request.Email} are not valid'.");
|
|
|
|
|
|
+ throw new AppException($"Credentials for '{request.Email} are not valid'.");
|
|
}
|
|
}
|
|
JwtSecurityToken jwtToken = await GenerateToken(user);
|
|
JwtSecurityToken jwtToken = await GenerateToken(user);
|
|
var response = new AuthResponse
|
|
var response = new AuthResponse
|
|
@@ -42,6 +42,7 @@ namespace MTWorkHR.Identity.Services
|
|
Id = user.Id,
|
|
Id = user.Id,
|
|
Email = user.Email,
|
|
Email = user.Email,
|
|
UserName = user.UserName,
|
|
UserName = user.UserName,
|
|
|
|
+ UserTypeId = user.UserType,
|
|
Token = new JwtSecurityTokenHandler().WriteToken( jwtToken),
|
|
Token = new JwtSecurityTokenHandler().WriteToken( jwtToken),
|
|
Expiration = jwtToken.ValidTo
|
|
Expiration = jwtToken.ValidTo
|
|
};
|
|
};
|