Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@
if (RemoteError is not null)
{
RedirectManager.RedirectToWithStatus("Account/Login", $"Error from external provider: {RemoteError}", HttpContext);
return;
}

var info = await SignInManager.GetExternalLoginInfoAsync();
if (info is null)
{
RedirectManager.RedirectToWithStatus("Account/Login", "Error loading external login information.", HttpContext);
return;
}

externalLoginInfo = info;
Expand Down Expand Up @@ -118,6 +120,7 @@
externalLoginInfo.Principal.Identity?.Name,
externalLoginInfo.LoginProvider);
RedirectManager.RedirectTo(ReturnUrl);
return;
}
else if (result.IsLockedOut)
{
Expand Down Expand Up @@ -168,13 +171,17 @@
{
RedirectManager.RedirectTo("Account/RegisterConfirmation", new() { ["email"] = Input.Email });
}

await SignInManager.SignInAsync(user, isPersistent: false, externalLoginInfo.LoginProvider);
RedirectManager.RedirectTo(ReturnUrl);
else
{
await SignInManager.SignInAsync(user, isPersistent: false, externalLoginInfo.LoginProvider);
RedirectManager.RedirectTo(ReturnUrl);
}
}
}

message = $"Error: {string.Join(",", result.Errors.Select(error => error.Description))}";
else
{
message = $"Error: {string.Join(",", result.Errors.Select(error => error.Description))}";
}
}

private ApplicationUser CreateUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@
{
RedirectManager.RedirectToCurrentPageWithStatus("Error: The external login was not removed.", HttpContext);
}

await SignInManager.RefreshSignInAsync(user);
RedirectManager.RedirectToCurrentPageWithStatus("The external login was removed.", HttpContext);
else
{
await SignInManager.RefreshSignInAsync(user);
RedirectManager.RedirectToCurrentPageWithStatus("The external login was removed.", HttpContext);
}
}

private async Task OnGetLinkLoginCallbackAsync()
Expand All @@ -145,14 +147,16 @@
}

var result = await UserManager.AddLoginAsync(user, info);
if (!result.Succeeded)
if (result.Succeeded)
{
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);

RedirectManager.RedirectToCurrentPageWithStatus("The external login was added.", HttpContext);
}
else
{
RedirectManager.RedirectToCurrentPageWithStatus("Error: The external login was not added. External logins can only be associated with one account.", HttpContext);
}

// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);

RedirectManager.RedirectToCurrentPageWithStatus("The external login was added.", HttpContext);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
if (!setPhoneResult.Succeeded)
{
RedirectManager.RedirectToCurrentPageWithStatus("Error: Failed to set phone number.", HttpContext);
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
if (user is null)
{
RedirectManager.RedirectToInvalidUser(UserManager, HttpContext);
return;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@
"Account/RegisterConfirmation",
new() { ["email"] = Input.Email, ["returnUrl"] = ReturnUrl });
}

await SignInManager.SignInAsync(user, isPersistent: false);
RedirectManager.RedirectTo(ReturnUrl);
else
{
await SignInManager.SignInAsync(user, isPersistent: false);
RedirectManager.RedirectTo(ReturnUrl);
}
}

private ApplicationUser CreateUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
if (result.Succeeded)
{
RedirectManager.RedirectTo("Account/ResetPasswordConfirmation");
return;
}

identityErrors = result.Errors;
Expand Down
Loading