protected virtual async Task <JTLoginResult <TTenant, TUser> > CreateLoginResultAsync(TUser user, TTenant tenant = null) { if (!user.IsActive) { return(new JTLoginResult <TTenant, TUser>(JTLoginResultType.UserIsNotActive)); } if (await IsEmailConfirmationRequiredForLoginAsync(user.TenantId) && !user.IsEmailConfirmed) { return(new JTLoginResult <TTenant, TUser>(JTLoginResultType.UserEmailIsNotConfirmed)); } if (await IsPhoneConfirmationRequiredForLoginAsync(user.TenantId) && !user.IsPhoneNumberConfirmed) { return(new JTLoginResult <TTenant, TUser>(JTLoginResultType.UserPhoneNumberIsNotConfirmed)); } var principal = await _claimsPrincipalFactory.CreateAsync(user); return(new JTLoginResult <TTenant, TUser>( tenant, user, principal.Identity as ClaimsIdentity )); }