public async Task <IActionResult> FindCourse(string q) { if (q == null || q.Length <= 3) { return(BadRequest(CommonResponse.Fail( "Due to the volume of courses, the search term will need to be greater than 3 characters"))); } var results = await _courseBusiness.FindCourse(q); return(Ok(CommonResponse.Success(results))); }
public async Task <IActionResult> Login(OpenIdConnectRequest request) { var user = await _userManager.FindByEmailAsync(request.Username); if (user == null) { return(BadRequest(CommonResponse.Fail("Invalid username or password"))); } var result = await _signInManager.CheckPasswordSignInAsync(user, request.Password, false); if (!result.Succeeded) { return(BadRequest(CommonResponse.Fail("Invalid username or password"))); } var ticket = await _ticketHelper.CreateTicketAsync(request, user); return(SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme)); }