Create a password for the user.
770931
def __create_password():  # pragma: no cover
        """"""
        salt = b64encode(API.__generate_string(32))
        password = b64encode(API.__generate_string(64))
        return b64encode(sha1(password + salt).digest())
579530
def login(self, user, passwd):
        ''''''
        resp = self.post('token', json={'username': user, 'password': passwd})
        self._token = resp.json()['response']['token']
451149
public function preparePassword()
    {
        $this->{$this->securePasswordField} = crypt(
            $this->{$this->securePasswordField},
            '$2y$10$' . sha1(microtime() . $this->username . $this->email) . '$'
        );
    }
386279
def prompt_for_credentials(username):
    '''

    '''
    message = 'Enter password for user "{0}": '.format(username)
    password = getpass.getpass(message)
    if not password:
        raise ValueError(
            'No credentials provided for user "{0}"'.format(username)
        )
    return password
177488
def _create_user(self, email, password, **extra_fields):
        """"""
        if not email:
            raise ValueError("The given email must be set")
        email = self.normalize_email(email)
        user = self.model(email=email, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user
220959
def construct_auth (self):
        """"""
        if self.auth:
            return
        _user, _password = self.get_user_password()
        if _user is not None and _password is not None:
            self.auth = (_user, _password)
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')
731403
def set_password(self, user, password):
        
        url = self._build_url(self.endpoint.set_password(id=user))
        return self._post(url, payload=dict(password=password))
637097
def create_user(username, password, **kwargs):
    
    try:
        User = get_model('user')
        user = User.get(User.c.username==username)
        if user:
            return False, {'username':"Username is already existed!"}
        user = User(username=username, password=password, **kwargs)
        user.set_password(password)
        user.save()
        return True, user
    except Exception as e:
        log.exception(e)
        return False, {'_': "Creating user failed!"}
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
1241109
def adduser(app, username, password):
    """"""
    with app.app_context():
        create_user(username=username, password=password)
        click.echo('user created!')
1253710
def set_password(url, ownerToken, password):
    '''
        
    '''
    
    service, fileId, key = sendclient.common.splitkeyurl(url)
    rawKey = sendclient.common.unpadded_urlsafe_b64decode(key)
    keys = sendclient.common.secretKeys(rawKey, password, url)
    
    return api_password(service, fileId, ownerToken, keys.newAuthKey)
740535
def create_user(self, name, password, is_super=False):
        
        statement = ddl.CreateUser(
            name=name, password=password, is_super=is_super
        )
        self._execute(statement)
1180460
def set_user_password(environment, parameter, password):
    
    username = '%s:%s' % (environment, parameter)
    return password_set(username, password)
645106
def setUserPasswdCredentials(self, username, password):
        """"""

        self.setCredentialValues(username=username, password=password)
976720
async def authenticate(self, username: str, password: str) -> None:
        """"""
        self._credentials = {
            'username': username,
            'password': password,
        }

        await self._get_security_token()
52903
def create():
    ''''''
    data = {
        'first_name': click.prompt('First name'),
        'last_name': click.prompt('Last name'),
        'email': click.prompt('Email'),
        'password': click.prompt('Password', hide_input=True),
        'password_confirm': click.prompt('Confirm Password', hide_input=True),
    }
    # Until https://github.com/mattupstate/flask-security/issues/672 is fixed
    with current_app.test_request_context():
        form = RegisterForm(MultiDict(data), meta={'csrf': False})
    if form.validate():
        data['password'] = encrypt_password(data['password'])
        del data['password_confirm']
        data['confirmed_at'] = datetime.utcnow()
        user = datastore.create_user(**data)
        success('User(id={u.id} email={u.email}) created'.format(u=user))
        return user
    errors = '\n'.join('\n'.join(e) for e in form.errors.values())
    exit_with_error('Error creating user', errors)