Create user by user profile from twitter
@param  {Object}   profile Profile from twitter
@param  {Function} callback      Callback with created user
168855
function createByTwitter(profile, callback) {
  if (!profile.id) {
    return callback(new Error('Profile id is undefined'));
  }

  this.findByTwitterID(profile.id, ok(callback, (user) => {
    if (user) {
      return callback(null, user);
    }

    this.create({
      username: profile.username || null,
      name: profile.displayName,
    }, ok(callback, (newUser) => {
      newUser.addProvider('twitter', profile.id, profile, ok(callback, () => {
        callback(null, newUser);
      }));
    }));
  }));
}
559887
function(name, force, callback) {
    var err = null;
    var profiles = this.all();

    if (~profiles.indexOf(name)) {
      err = 'Profile "' + name + '" already exists.';

    } else if (!force && ~RESERVED_PROFILE_NAME.indexOf(name)) {
      err = 'Profile name "' + name + '" is reserved by `multi-profile`';

    } else if (/^_/.test(name)) {
      err = 'Profile name "' + name + '" should not begin with `_`';

    } else {
      profiles.push(name);
      this.attr.set('profiles', profiles);
    }

    var data = {
      err: err,
      name: name
    };
    this.emit('add', data);

    callback && callback(err, data);
  }
624475
def profile_update(request, template="accounts/account_profile_update.html",
                   extra_context=None):
    
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None,
                        instance=request.user)
    if request.method == "POST" and form.is_valid():
        user = form.save()
        info(request, _("Profile updated"))
        try:
            return redirect("profile", username=user.username)
        except NoReverseMatch:
            return redirect("profile_update")
    context = {"form": form, "title": _("Update Profile")}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
448649
function createUser(form) {
      // refuse to work with invalid data
      if (vm.user._id || (form && !form.$valid)) {
        return;
      }

      Auth.createUser(vm.user)
        .then(createUserSuccess)
        .catch(createUserCatch);

      function createUserSuccess(newUser) {
        Toast.show({
          type: 'success',
          text: 'User ' + newUser.name + ' has been created',
          link: {state: 'admin.user.list.detail', params: {id: newUser._id}}
        });
        vm.close();
      }

      function createUserCatch(err) {
        if (form && err) {
          form.setResponseErrors(err);
        }

        Toast.show({
          type: 'warn',
          text: 'Error while creating a new user'
        });
      }
    }
568873
function(callback){
    var options = this.options,
        cache = this.options.cache,
        logger =  this.options.logger;
    
    if(this.apiInterface){
      logger.info('fetch data from api: ' + this.apiInterface.name);
    
      var sgn = this.profile.identity.sgn || '',
          self = this;

      try
      {
        this.apiInterface.getProfile(this.url, sgn, options, function(hCard){
          if(hCard){
            self.profile.hCards = [hCard];
          }
          self.status = "fetched";
          callback();
        });
      }
      catch(err)
      {
        logger.warn('error getting api data with plugin for: ' + self.domain + ' - ' + err);
        self.error = err;
        self.status = "errored";
        callback();
      }
    }


  }
40236
function getProfile(provider, access_token, callback) {
  let fields;
  switch (provider) {
    case 'facebook':
      facebook.query().get('me?fields=name,email').auth(access_token).request(function (err, res, body) {
        if (err) {
          callback(err);
        } else {
          callback(null, {
            username: body.name,
            email: body.email
          });
        }
      });
      break;
    case 'google':
      google.query('plus').get('people/me').auth(access_token).request(function (err, res, body) {
        if (err) {
          callback(err);
        } else {
          callback(null, {
            username: body.displayName,
            email: body.emails[0].value
          });
        }
      });
      break;
    case 'github':
      github.query().get('user').auth(access_token).request(function (err, res, body) {
        if (err) {
          callback(err);
        } else {
          callback(null, {
            username: body.login,
            email: body.email
          });
        }
      });
      break;
    case 'linkedin2':
      fields = [
        'public-profile-url', 'email-address'
      ];
      linkedin.query().select('people/~:(' + fields.join() + ')?format=json').auth(access_token).request(function (err, res, body) {
        if (err) {
          callback(err);
        } else {
          callback(null, {
            username: substr(body.publicProfileUrl.lastIndexOf('/') + 1),
            email: body.emailAddress
          });
        }
      });
      break;
    default:
      callback({
        message: 'Unknown provider.'
      });
      break;
  }
}
1335824
public void createUser(final String userId, final String displayName,
			final String profilePicturePath) {
		final Node user = NeoUtils.createUserNode(userId);
		user.setProperty(Properties.User.DISPLAY_NAME, displayName);
		user.setProperty(Properties.User.PROFILE_PICTURE_PATH,
				profilePicturePath);
	}
990098
def create_userena_profile(self, user):
        
        if isinstance(user.username, text_type):
            user.username = smart_text(user.username)
        salt, activation_key = generate_sha1(user.username)

        try:
            profile = self.get(user=user)
        except self.model.DoesNotExist:
            profile = self.create(user=user,
                           activation_key=activation_key)
        return profile
262025
def __load_profile(self, profile, uuid, verbose):
        """"""

        def is_empty_profile(prf):
            return not (prf.name or prf.email or
                        prf.gender or prf.gender_acc or
                        prf.is_bot or prf.country_code)

        uid = api.unique_identities(self.db, uuid)[0]

        if profile:
            self.__create_profile(profile, uuid, verbose)
        elif is_empty_profile(uid.profile):
            self.__create_profile_from_identities(uid.identities, uuid, verbose)
        else:
            self.log("-- empty profile given for %s. Not updated" % uuid, verbose)
864159
def fromProfile(cls, profile):
        
        session = bones.SessionAPI.fromProfile(profile)
        return cls(session)
312996
function _createUser(){
    var newUser = null,
        avatar = '';

        if(this.socialUserInfo.image['60x60']){
            avatar = this.socialUserInfo.image['60x60'].url;
        }

        newUser = {
            role: 'external',
            identities: {
                pinterest: {
                    id: this.socialUserInfo.id,
                    accessToken: this.options.access_token,
                    screen_name: this.socialUserInfo.username
                }
            },
            linkedidentities: ['pinterest'],
            profile: {
                picture: avatar
            },
            displayname: this.socialUserInfo.username,
            enabled: true,
            email: '',
            firstname: this.socialUserInfo.first_name,
            lastname: this.socialUserInfo.last_name
        };

    return db.users.insert(newUser);
}
575054
def create_for_user(self, user):
        
        # support passing email address too
        if type(user) is unicode:
            from .profile import Profile as User
            user = User.objects.get(email=user)

        temp_key = token_generator.make_token(user)

        # save it to the password reset model
        password_reset = PasswordReset(user=user, temp_key=temp_key)
        password_reset.save()

        # send the password reset email
        subject = _("Password reset email sent")
        message = render_to_string("profiles/email_messages/password_reset_key_message.txt", {
            "user": user,
            "uid": int_to_base36(user.id),
            "temp_key": temp_key,
            "site_url": settings.SITE_URL,
            "site_name": settings.SITE_NAME
        })
        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email])

        return password_reset
575573
function _createUser(){
    var excludedFields = ['name', 'screen_name', 'profile_image'],
        nameparts = this.socialUserInfo.name.split(' '),
        newUser = {
        role: 'external',
        identities: {
            twitter: {
                id: this.socialUserInfo.id_str,
                accessToken: this.options.oauth_token,
                accessSecret: this.options.oauth_token_secret,
                screen_name: this.socialUserInfo.screen_name
            }
        },
        linkedidentities: ['twitter'],
        profile: {
            picture: this.socialUserInfo.profile_image_url
        },
        enabled: true,
        email: '',
        displayname: this.socialUserInfo.screen_name,
        firstname: nameparts[0],
        lastname: (nameparts.length > 1) ? nameparts[1] : ' '
    };

    _.each(profileFieldsArr, function(field){
        if(excludedFields.indexOf(field) === -1){
            newUser.profile[field] = this.socialUserInfo[field];
        }
    }.bind(this));

    return db.users.insert(newUser);
}
1364153
def get_basic_profile(self, user_id, scope='profile/public'):
        
        profile = _get(
            token=self.oauth.get_app_token(scope),
            uri='/user/profile/' + urllib.quote(user_id)
        )

        try:
            return json.loads(profile)
        except:
            raise MxitAPIException('Error parsing profile data')
658075
def create_workshift_profile(sender, instance, created, **kwargs):
    '''
    
    '''
    if instance.user.username == ANONYMOUS_USERNAME or \
       instance.status != UserProfile.RESIDENT:
        return

    try:
        semester = Semester.objects.get(current=True)
    except (Semester.DoesNotExist, Semester.MultipleObjectsReturned):
        pass
    else:
        profile, created = WorkshiftProfile.objects.get_or_create(
            user=instance.user,
            semester=semester,
        )
        if created:
            utils.make_workshift_pool_hours(
                semester=semester,
                profiles=[profile],
            )
948322
public function create(array $credentials, \Closure $callback = null)
    {
        $user = $this->createUser($credentials);

        if ($callback)
        {
            if ($callback($user) === false)
            {
                return false;
            }
        }

        return $this->save($user);
    }
711840
function(type, obj) {
     switch (type) {
       case 'greet':
         var name = _.get(obj, 'profile.displayName') || _.get(obj, 'username', '') || obj;

         return _.get(name, 'length') ? name : 'Hey';
         break;
     }

     return obj; 
    }