public async Task <IActionResult> Login(LoginRequestModel model) { ICollection <ApplicationUserRole> roles = new List <ApplicationUserRole>(); if (await _authService.AreCredentialsValidAsync(new Credentials { Email = model.Email, PasswordHash = model.Password })) { var token = _JWTService.CreateLoginToken(new ApplicationUser { Email = model.Email, UserRoles = roles }); return(Ok(new LoginResponseModel { Status = "Success", Message = "User has logged in", JWTToken = token })); } return(Unauthorized(new LoginResponseModel { Status = "Error", Message = "The provided credentials could not be validated" })); }