Ejemplo n.º 1
0
        private async Task <ProfileVM> GetProfileVM(IUser user, ChangeProfileModel model = null, string errorMessage = null, string successMessage = null)
        {
            var externalSchemes = await signInManager.GetExternalAuthenticationSchemesAsync();

            var externalProviders = externalSchemes.Select(x => new ExternalProvider(x.Name, x.DisplayName)).ToList();

            var result = new ProfileVM
            {
                Id                = user.Id,
                Email             = user.Email,
                ErrorMessage      = errorMessage,
                ExternalLogins    = user.Logins,
                ExternalProviders = externalProviders,
                DisplayName       = user.DisplayName(),
                HasPassword       = await userManager.HasPasswordAsync(user),
                HasPasswordAuth   = identityOptions.Value.AllowPasswordAuth,
                SuccessMessage    = successMessage
            };

            if (model != null)
            {
                SimpleMapper.Map(model, result);
            }

            return(result);
        }
Ejemplo n.º 2
0
        private async Task <ProfileVM> GetProfileVM(IUser user, ChangeProfileModel model = null)
        {
            var result = new ProfileVM
            {
                Email           = user.Email,
                DisplayName     = user.DisplayName(),
                PictureUrl      = user.PictureUrl(),
                HasPassword     = await userManager.HasPasswordAsync(user),
                HasPasswordAuth = identityOptions.Value.AllowPasswordAuth
            };

            if (model != null)
            {
                SimpleMapper.Map(model, result);
            }

            return(result);
        }