Try to get `email` from `AbpClaimTypes.Email` and `ClaimTypes.Email`.

pull/17883/head
maliming 1 year ago
parent d7fbcb95f2
commit dc893bc40c
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4

@ -229,7 +229,7 @@ public class LoginModel : AccountPageModel
//TODO: Handle other cases for result!
var email = loginInfo.Principal.FindFirstValue(AbpClaimTypes.Email);
var email = loginInfo.Principal.FindFirstValue(AbpClaimTypes.Email) ?? loginInfo.Principal.FindFirstValue(ClaimTypes.Email);
if (email.IsNullOrWhiteSpace())
{
return RedirectToPage("./Register", new {
@ -268,7 +268,7 @@ public class LoginModel : AccountPageModel
{
await IdentityOptions.SetAsync();
var emailAddress = info.Principal.FindFirstValue(AbpClaimTypes.Email);
var emailAddress = info.Principal.FindFirstValue(AbpClaimTypes.Email) ?? info.Principal.FindFirstValue(ClaimTypes.Email);
var userName = await GetUserNameFromEmail(emailAddress);
var user = new IdentityUser(GuidGenerator.Create(), userName, emailAddress, CurrentTenant.Id);

@ -12,6 +12,7 @@ using Microsoft.Extensions.Options;
using Volo.Abp.Account.Settings;
using Volo.Abp.Auditing;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
using Volo.Abp.Settings;
using Volo.Abp.Validation;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
@ -92,7 +93,7 @@ public class RegisterModel : AccountPageModel
}
var identity = externalLoginInfo.Principal.Identities.First();
var emailClaim = identity.FindFirst(ClaimTypes.Email);
var emailClaim = identity.FindFirst(AbpClaimTypes.Email) ?? identity.FindFirst(ClaimTypes.Email);
if (emailClaim == null)
{

Loading…
Cancel
Save