Ad-hoc creation of user.
546874
private function createUserByOAuthUserResponse(UserResponseInterface $response): SyliusUserInterface
    {
        /** @var SyliusUserInterface $user */
        $user = $this->userFactory->createNew();

        $canonicalEmail = $this->canonicalizer->canonicalize($response->getEmail());

        /** @var CustomerInterface $customer */
        $customer = $this->customerRepository->findOneBy(['emailCanonical' => $canonicalEmail]);

        if (null === $customer) {
            /** @var CustomerInterface $customer */
            $customer = $this->customerFactory->createNew();
        }

        $user->setCustomer($customer);

        // set default values taken from OAuth sign-in provider account
        if (null !== $email = $response->getEmail()) {
            $customer->setEmail($email);
        }

        if (null !== $name = $response->getFirstName()) {
            $customer->setFirstName($name);
        } elseif (null !== $realName = $response->getRealName()) {
            $customer->setFirstName($realName);
        }

        if (null !== $lastName = $response->getLastName()) {
            $customer->setLastName($lastName);
        }

        if (!$user->getUsername()) {
            $user->setUsername($response->getEmail() ?: $response->getNickname());
        }

        // set random password to prevent issue with not nullable field & potential security hole
        $user->setPlainPassword(substr(sha1($response->getAccessToken()), 0, 10));

        $user->setEnabled(true);

        return $this->updateUserByOAuthUserResponse($user, $response);
    }
760181
def create_user(email, password, active, confirmed_at, send_email):
    
    if confirmed_at == 'now':
        confirmed_at = security.datetime_factory()
    user = user_manager.create(email=email, password=password, active=active,
                               confirmed_at=confirmed_at)
    if click.confirm(f'Are you sure you want to create {user!r}?'):
        security_service.register_user(user, allow_login=False, send_email=send_email)
        user_manager.save(user, commit=True)
        click.echo(f'Successfully created {user!r}')
    else:
        click.echo('Cancelled.')
1170710
def create(self, data, *args, **kwargs):
        
        super(MambuUser, self).create(data)
        self['user'][self.customFieldName] = self['customInformation']
        self.init(attrs=self['user'])
273086
def create_user(**data):
    """"""
    if 'username' not in data or 'password' not in data:
        raise ValueError('username and password are required.')

    # Hash the user password
    data['password'] = generate_password_hash(
        data.pop('password'),
        method='pbkdf2:sha256'
    )

    # Here you insert the `data` in your users database
    # for this simple example we are recording in a json file
    db_users = json.load(open('users.json'))
    # add the new created user to json
    db_users[data['username']] = data
    # commit changes to database
    json.dump(db_users, open('users.json', 'w'))
    return data
292095
def create_user(self, username, password, tags=""):
        
        path = Client.urls['users_by_name'] % username
        body = json.dumps({'password': password, 'tags': tags})
        return self._call(path, 'PUT', body=body,
                                 headers=Client.json_headers)
1069746
def create_user(backend, details, response, uid, username, user=None, *args, **kwargs):
    
    if user:
        return {'user': user}
    if not username:
        return None
    email = details.get('email')
    original_email = None
    # email is required
    if not email:
        message = _("""your social account needs to have a verified email address in order to proceed.""")
        raise AuthFailed(backend, message)
    # Avoid hitting field max length
    if email and len(email) > 75:
        original_email = email
        email = ''
    return {
        'user': UserSocialAuth.create_user(username=username,
                                           email=email,
                                           sync_emailaddress=False),
        'original_email': original_email,
        'is_new': True
    }
677217
def cli(obj, name, email, password, status, text):
    """"""
    client = obj['client']
    if not email:
        raise click.UsageError('Need "--email" to sign-up new user.')
    if not password:
        raise click.UsageError('Need "--password" to sign-up new user.')
    try:
        r = client.signup(name=name, email=email, password=password, status=status, attributes=None, text=text)
    except Exception as e:
        click.echo('ERROR: {}'.format(e))
        sys.exit(1)
    if 'token' in r:
        click.echo('Signed Up.')
    else:
        raise AuthError
1241109
def adduser(app, username, password):
    """"""
    with app.app_context():
        create_user(username=username, password=password)
        click.echo('user created!')
922687
private void createUser(Session session, UserImpl user, boolean broadcast) throws Exception
   {
      Node userStorageNode = utils.getUsersStorageNode(session);
      Node userNode = userStorageNode.addNode(user.getUserName());

      if (user.getCreatedDate() == null)
      {
         Calendar calendar = Calendar.getInstance();
         user.setCreatedDate(calendar.getTime());
      }
      user.setInternalId(userNode.getUUID());

      if (broadcast)
      {
         preSave(user, true);
      }

      writeUser(user, userNode);
      session.save();

      putInCache(user);

      if (broadcast)
      {
         postSave(user, true);
      }
   }
228482
def allow_user(user):
    """"""
    def processor(action, argument):
        db.session.add(
            ActionUsers.allow(action, argument=argument, user_id=user.id)
        )
    return processor
984463
public void createUser(User user, String password){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.CreateUser);
        byte[] secret = null;
        if(password != null && ! password.isEmpty()){
            secret = ObfuscatUtil.base64Encode(password.getBytes());
        }
        CreateUserProtocol p = new CreateUserProtocol(user, secret);

        connection.submitRequest(header, p, null);
    }
1160463
def create(cls, community_id, user_id, **data):
        """"""
        with db.session.begin_nested():
            obj = cls(id=community_id, id_user=user_id, **data)
            db.session.add(obj)
        return obj
1371824
def add_user(self, username, password):
        """"""
        self.server.user_dict[username] = password
        self.server.isAuth = True
152923
def prj_create_user(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        user = self.create_user(projects=[self.cur_prj])
        if user:
            userdata = djitemdata.UserItemData(user)
            treemodel.TreeItem(userdata, self.prj_user_model.root)
350147
def run_create_admin(*args):
    '''
    
    '''
    post_data = {
        'user_name': 'giser',
        'user_email': 'giser@osgeo.cn',
        'user_pass': '131322',
        'role': '3300',
    }
    if MUser.get_by_name(post_data['user_name']):
        print('User {user_name} already exists.'.format(user_name='giser'))
    else:
        MUser.create_user(post_data)
566949
function create(user, callback) {
      var cb = callback || angular.noop;

      return User.create(user,
        function (user) {
          return cb(user);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
1151655
def create(self, validated_data):
        ''''''
        validated_data['username'] = validated_data['email']
        admin = validated_data.pop('is_superuser', None)

        if admin is True:
            user = User.objects.create_superuser(**validated_data)
        else:
            user = User.objects.create_user(**validated_data)

        return user