Browse Source

Merge pull request #4899 from abpframework/maliming/account-pacth

Use alerts to show the exception message in the register page.
pull/5011/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
fd45b4d5dc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs

32
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs

@ -76,25 +76,33 @@ namespace Volo.Abp.Account.Web.Pages.Account
public virtual async Task<IActionResult> OnPostAsync()
{
await CheckSelfRegistrationAsync();
if (IsExternalLogin)
try
{
var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
if (externalLoginInfo == null)
await CheckSelfRegistrationAsync();
if (IsExternalLogin)
{
var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
if (externalLoginInfo == null)
{
Logger.LogWarning("External login info is not available");
return RedirectToPage("./Login");
}
await RegisterExternalUserAsync(externalLoginInfo, Input.EmailAddress);
}
else
{
Logger.LogWarning("External login info is not available");
return RedirectToPage("./Login");
await RegisterLocalUserAsync();
}
await RegisterExternalUserAsync(externalLoginInfo, Input.EmailAddress);
return Redirect(ReturnUrl ?? "~/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow!
}
else
catch (BusinessException e)
{
await RegisterLocalUserAsync();
Alerts.Danger(e.Message);
return Page();
}
return Redirect(ReturnUrl ?? "~/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow!
}
protected virtual async Task RegisterLocalUserAsync()

Loading…
Cancel
Save