Skip to content

Commit

Permalink
Shazwazza#112 Fixed error
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-roffey-dotcentric committed Jan 29, 2020
1 parent 7c0eda4 commit c633fb7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,26 @@ public async Task<ActionResult> ManagePassword([Bind(Prefix = "managePasswordMod
[AllowAnonymous]
public async Task<ActionResult> HandleLogin([Bind(Prefix = "loginModel")] LoginModel model)
{
if (ModelState.IsValid)
if (!ModelState.IsValid)
return CurrentUmbracoPage();

var user = await _userManager.FindAsync(model.Username, model.Password);

if (user != null)
{
var user = await _userManager.FindAsync(model.Username, model.Password);
if (user != null)
//member exits but registered with social login.
if (user.PasswordHash == null)
{
await SignInAsync(user, true);
return RedirectToCurrentUmbracoPage();
ModelState.AddModelError("loginModel", "Social Account registered");
return CurrentUmbracoPage();
}
ModelState.AddModelError("loginModel", "Invalid username or password");

await SignInAsync(user, true);
return RedirectToCurrentUmbracoPage();
}

ModelState.AddModelError("loginModel", "Invalid username or password");

return CurrentUmbracoPage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class IdentityEnabledMembersMembershipProvider : MembersMembershipProvide

public new bool VerifyPassword(string password, string hashedPassword)
{
//member exits but registered with social login.
if (hashedPassword == null)
return true;

return CheckPassword(password, hashedPassword);
}

Expand Down

0 comments on commit c633fb7

Please sign in to comment.