private async Task <RequestResult <AuthorizationData> > CreateNewFacebookUser(TokenInfo tokenInfo, TenantContext requestTenant) { var userGuid = _guid.GetGuid(); var userData = _mapper.Map <CreateUserData>(tokenInfo); userData.UserGuid = userGuid; userData.TenantId = requestTenant.TenantId; userData.AvatarType = AvatarType.Facebook; var user = await _authRepository.CreateFacebookUser(userData); await _avatarRepository .StoreAvatar(user.Id, AvatarType.Facebook, tokenInfo.ImageUrl); return(await GetAuthorizationDataResult(requestTenant, user)); }
public override async Task <RequestResult <UserDto> > Handle(RegisterUserWithCredentialsCommand request, CancellationToken cancellationToken) { var imageUrl = _profileImageUrlProvider.GetImageUrl(request.Email); var user = await _authRepository.CreateUser(new CreateUserData { Email = request.Email, Password = request.Password, DisplayName = request.DisplayName, ImageUrl = imageUrl, TenantId = request.RequestContext.Tenant.TenantId, UserGuid = request.UserGuid, AvatarType = AvatarType.Gravatar, }); await _avatarRepository .StoreAvatar(user.Id, AvatarType.Gravatar, imageUrl); await _mediator .Publish(new UserRegisteredWithCredentials(user.UserGuid), cancellationToken); return(RequestResult <UserDto> .Success(_mapper.Map <UserDto>(user))); }