Commit 22786e30 authored by hasan khaddour's avatar hasan khaddour

fix roles loading issues

parent ab64adee
...@@ -30,6 +30,7 @@ namespace PSManagement.Infrastructure.Services.Authentication ...@@ -30,6 +30,7 @@ namespace PSManagement.Infrastructure.Services.Authentication
public async Task<Result<AuthenticationResult>> Login(String email, String password) { public async Task<Result<AuthenticationResult>> Login(String email, String password) {
_specification.AddInclude(e => e.Employee); _specification.AddInclude(e => e.Employee);
_specification.AddInclude(e=> e.Roles);
User u = await _userRepository.GetByEmail(email,_specification); User u = await _userRepository.GetByEmail(email,_specification);
if (u is null || u.HashedPassword != password) { if (u is null || u.HashedPassword != password) {
...@@ -43,6 +44,7 @@ namespace PSManagement.Infrastructure.Services.Authentication ...@@ -43,6 +44,7 @@ namespace PSManagement.Infrastructure.Services.Authentication
Email=u.Email, Email=u.Email,
FirstName=u.Employee.PersonalInfo.FirstName, FirstName=u.Employee.PersonalInfo.FirstName,
LastName =u.Employee.PersonalInfo.LastName, LastName =u.Employee.PersonalInfo.LastName,
Roles=_mapper.Map<ICollection<RoleDTO>>(u.Roles),
Token=token}; Token=token};
} }
public async Task<Result<AuthenticationResult>> Register(String email, String userName, String password) { public async Task<Result<AuthenticationResult>> Register(String email, String userName, String password) {
......
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