public async Task<HttpResponseMessage> Login(Credential credential) { //await Seed(); IdentityResult result = await IdentityManager.Authentication.CheckPasswordAndSignInAsync(AuthenticationManager, credential.Username, credential.Password, credential.RememberMe); HttpStatusCode code = HttpStatusCode.OK; object content = null; if (result.Success) { content = new { Result = "true" }; } else { code = HttpStatusCode.Unauthorized; content = new { Result = result.Errors }; } var jsonFormatter = Configuration.Formatters.OfType<JsonMediaTypeFormatter>().First(); jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); var response = Request.CreateResponse(code, content, jsonFormatter); return response; }
public HttpResponseMessage LoginDummy(Credential credential) { //this is just a dummy location for faking ajax login // forms in iframes --so browsers will remember passwords return new HttpResponseMessage(HttpStatusCode.OK); }