Adds a user with password
172469
def add(self, user, password):
        
        if self.__contains__(user):
            raise UserExists
        self.new_users[user] = self._encrypt_password(password) + "\n"
1136335
def _create_user(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    if ctx.obj['db'].objectmodels['user'].count({'name': username}) > 0:
        raise KeyError()

    new_user = ctx.obj['db'].objectmodels['user']({
        'uuid': str(uuid4()),
        'created': std_now()
    })

    new_user.name = username
    new_user.passhash = passhash

    return new_user
1167005
def create_admin_set_password(self, password):
        
        with open(self.sitedir + '/run/admin.json', 'w') as out:
            json.dump({
                'name': 'admin',
                'email': 'none',
                'password': password,
                'sysadmin': True},
                out)
        self.user_run_script(
            script=scripts.get_script_path('update_add_admin.sh'),
            args=[],
            db_links=True,
            ro={
                self.sitedir + '/run/admin.json': '/input/admin.json'
               },
            )
        remove(self.sitedir + '/run/admin.json')
849752
public function addUser($user)
    {
        //only add the information if there are username and password
        if ($user && $this->getPass()) {
            $this->fullUrl['credentials'] = $user . ':' . $this->getPass() . '@';
        }

        return $this;
    }
101851
public function addUser($user, $password)
    {
        $params = [
            'name' => $user,
            'password' => $password,
        ];

        $body = $this->request(self::URI_AUTH_USER_ADD, $params);

        return $body;
    }
276959
function addUser(req, res, next) {
  res.locals.user = req.user;
  next();
}
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)
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
397343
def change_password(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    change_user = ctx.obj['db'].objectmodels['user'].find_one({
        'name': username
    })
    if change_user is None:
        log('No such user', lvl=warn)
        return

    change_user.passhash = passhash
    change_user.save()

    log("Done")
666426
def set_password(self, password):
        
        self.password = Security.hash(password)
        self.save()
518866
function addUser($username, $password, $additional = "")
    {
        if (function_exists($this->options['cryptType'])) {
            $cryptFunction = $this->options['cryptType'];
        } else {
            $cryptFunction = 'md5';
        }

        $additional_key   = '';
        $additional_value = '';

        if (is_array($additional)) {
            foreach ($additional as $key => $value) {
                $additional_key .= ', ' . $key;
                $additional_value .= ", '" . $value . "'";
            }
        }

        $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES ('%s', '%s'%s)",
                         $this->options['table'],
                         $this->options['usernamecol'],
                         $this->options['passwordcol'],
                         $additional_key,
                         $username,
                         $cryptFunction($password),
                         $additional_value
                         );

        $res = $this->query($query);

        if (DB::isError($res)) {
           return PEAR::raiseError($res->getMessage(), $res->getCode());
        } else {
          return true;
        }
    }
1254180
def setNewPassword(self, url, username, password):
        
        self.br.add_password(url, username, password)
320993
def login_with_password(bot, name, password)
            send Common::Login.new(bot, name, password, nil)
        end
105562
public function add()
    {
        $this->defaultData();
        $container = new tao_actions_form_Users($this->getClass(TaoOntology::CLASS_URI_TAO_USER));
        $form = $container->getForm();

        if ($form->isSubmited()) {
            if ($form->isValid()) {
                $values = $form->getValues();
                $values[GenerisRdf::PROPERTY_USER_PASSWORD] = core_kernel_users_Service::getPasswordHash()->encrypt($values['password1']);
                $plainPassword = $values['password1'];
                unset($values['password1']);
                unset($values['password2']);

                $user = $container->getUser();
                $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($container->getUser());

                if ($binder->bind($values)) {
                    $this->getEventManager()->trigger(new UserUpdatedEvent(
                            $user,
                            array_merge($values, ['hashForKey' => UserHashForEncryption::hash($plainPassword)]))
                    );
                    $this->setData('message', __('User added'));
                    $this->setData('exit', true);
                }
            }
        }

        $this->setData('loginUri', tao_helpers_Uri::encode(GenerisRdf::PROPERTY_USER_LOGIN));
        $this->setData('formTitle', __('Add a user'));
        $this->setData('myForm', $form->render());
        $this->setView('user/form.tpl');
    }
1173659
def add_user(self, name, password=None, read_only=None, db=None, **kwargs):
        
        if db is None:
            return self.get_connection().admin.add_user(
                    name, password=password, read_only=read_only, **kwargs)
        return self.get_connection()[db].add_user(
                    name, password=password, read_only=read_only, **kwargs)
6707
def set_basic_auth(self, username, password, realm):
    
    self._passmgr.add_password(realm, self._base_url, username, password)
    return self
435843
def register(self, password):
        """"""

        if len(password) < 8:
            raise ValueError("Password must be at least 8 characters.")

        params = {"name": self.nick, "password": password}
        resp = self.conn.make_api_call("register", params)

        if "error" in resp:
            raise RuntimeError(f"{resp['error'].get('message') or resp['error']}")

        self.conn.make_call("useSession", resp["session"])
        self.conn.cookies.update({"session": resp["session"]})
        self.logged_in = True