Exemple #1
0
        public async Task <ActionResult <ProfileDTO> > Profile()
        {
            _logger.LogInformation("Get profile");
            if (_userResolver.IsAuthenticated)
            {
                dynamic profile = await _userResolver.GetProfileAsync();

                if (_inviteOnlyModeConfig.Enabled)
                {
                    var inviteOnlyChecker = new InviteOnlyChecker(_inviteOnlyModeConfig);
                    if (!profile.emailVerified || !inviteOnlyChecker.IsInvited(profile.emailId))
                    {
                        return(StatusCode(403));
                    }
                }
                return(new ProfileDTO {
                    Name = profile.firstName + " " + profile.lastName, AvatarUrl = profile.profileImages.sizeX40
                });
            }
            else
            {
                return(AnonymousProfile);
            }
        }