public async Task <LoginResult> Login(LoginModel model) { var user = await _userManager.FindByNameAsync(model.EmployeeId); if (user is null) { return(LoginResult.CreateFailed()); } var isPasswordCorrect = await _userManager.CheckPasswordAsync(user, model.Password); if (!isPasswordCorrect) { return(LoginResult.CreateFailed()); } var principal = await _signInManager.CreateUserPrincipalAsync(user); var token = CreateToken(principal); return(LoginResult.CreateSucceeded(token)); }