I would like to authenticate user using Parse Library.
Here are the methods which I would like to make it asyc as api call supports only async call. I am new to MVC and aysc/await functionality. Problem now is that it goes in await method and never returns result and view cant be loaded.
I spend quite some time understanding and trying to use different options but no success yet.
Do I need to use Partialviews or something can be done in ValidateUser method. Any sample code is really appreciated. Thanks.
AccountController.cs
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
{
var loggedIn = true;
}
return View(model);
}
ParseMembershipProvider : ExtendedMembershipProvider
public override bool ValidateUser(string username, string password)
{
var pUserRepo = new PUserRepository();
bool flag = false;
var requiredUser = pUserRepo.GetUserObjByUserName(username, password );
if (requiredUser.Result != null)
flag = true;
return flag;
}
PUserRepository.cs
public async Task<ParseUser> GetUserObjByUserName(string userName, string passWord)
{
return await ParseUser.LogInAsync("test1", "test123");
}