Internal: Create a new Entry with the given user, password, and algorithm
 Internal: set the algorithm for the entry
425558
def algorithm=(alg)
      if alg.kind_of?(Array) then
        if alg.size == 1 then
          @algorithm = alg.first
        else
          @algorithm = alg
        end
      else
        @algorithm = Algorithm.algorithm_from_name(alg) unless Algorithm::EXISTING == alg
      end
      return @algorithm
    end
1314067
@Override
    public User createUser(String username, String password)
            throws AuthenticationException {
        String user = file_store.getProperty(username);
        if (user != null) {
            throw new AuthenticationException("User '" + username
                    + "' already exists.");
        }
        // Encrypt the new password
        String ePwd = encryptPassword(password);
        file_store.put(username, ePwd);
        try {
            saveUsers();
        } catch (IOException e) {
            throw new AuthenticationException("Error changing password: ", e);
        }

        return getUser(username);
    }
1262916
private static <A, B> Entry<A, B> createEntry(A text, B field) {
        return new SimpleImmutableEntry<>(text, field);
    }
171644
def _add_entry(self, formdata=None, data=unset_value, index=None):
        '''
        
        '''
        if formdata:
            prefix = '-'.join((self.name, str(index)))
            basekey = '-'.join((prefix, '{0}'))
            idkey = basekey.format('id')
            if prefix in formdata:
                formdata[idkey] = formdata.pop(prefix)
            if hasattr(self.nested_model, 'id') and idkey in formdata:
                id = self.nested_model.id.to_python(formdata[idkey])
                data = get_by(self.initial_data, 'id', id)

                initial = flatten_json(self.nested_form,
                                       data.to_mongo(),
                                       prefix)

                for key, value in initial.items():
                    if key not in formdata:
                        formdata[key] = value
            else:
                data = None
        return super(NestedModelList, self)._add_entry(formdata, data, index)
851594
def create(email, password):
    
    with get_app().app_context():
        user = User(email=email, password=password)
        result = user_service.save(user)
        if not isinstance(result, User):
            print_validation_errors(result)
            return

        click.echo(green('\nUser created:'))
        click.echo(green('-' * 40))
        click.echo(str(user) + '\n')
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
64275
function createUser(name, pass, cb) {
  // Check name
  if(!isValidName(name)) return cb(new Error('Invalid name "'+name+'"'))
  // Check pass
  if(!isValidPass(pass)) return cb(new Error('Invalid pass: "'+pass+'"'))
  // gen salt
  var salt = crypto.randomBytes(16).toString('hex')
  // gen sha1
  var hash = crypto.createHash('sha1')
  hash.update(pass)
  hash.update(salt)
  var password_sha = hash.digest('hex')
  
  var new_doc =
      { _id: user_namespace+':'+name
      , name: name
      , roles: []
      , type: 'user'
      , password_sha: password_sha
      , salt: salt
      }
    ;
  
  nano().use(user_dbname).insert(new_doc, function(err, doc, h) {
    if(err) return cb(err)
    
    // Every user gets its own database
    createDatabase(name, function(err) {
      if(err) return cb(err)
      
      // Sets the _security
      setDatabaseSecurity(name, function(err) {
        if(err) return cb(err)
        cb(null, doc.id, doc.rev)
      })
    })
  })
}
2229
def _create_user(
            self, username, email, short_name, full_name,
            institute, password, is_admin, **extra_fields):
        

        # Create Person
        person = self.model(
            username=username, email=email,
            short_name=short_name, full_name=full_name,
            is_admin=is_admin,
            institute=institute,
            **extra_fields
        )
        person.set_password(password)
        person.save()
        return person
534013
def new(cls, password, rounds):
        """"""
        if isinstance(password, str):
            password = password.encode('utf-8')
        return cls(cls._new(password, rounds))
1129108
def add_algorithm(self, parser):
        """"""

        help = 'The HashAlgorithm that will be used to generate the signature (default: %(default)s).' % {
            'default': ca_settings.CA_DIGEST_ALGORITHM.name, }

        parser.add_argument(
            '--algorithm', metavar='{sha512,sha256,...}', default=ca_settings.CA_DIGEST_ALGORITHM,
            action=AlgorithmAction, help=help)
647742
def add_entry(self, **kw):
        
        self.data.setdefault('entries', []).append(
            {'{}_entry'.format(self.typeof): kw})
312666
static void putEntry(final int charsetId, String mysqlCharset, String mysqlCollation, String javaCharset) {
        entries[charsetId] = new Entry(charsetId, mysqlCharset, // NL
            mysqlCollation,
            javaCharset);
    }
83150
def use(self, algorithm):
        
        algorithm = algorithm.lower()
        if algorithm == "md5":
            self.default_hash_method = hashlib.md5
        elif algorithm == "sha1":
            self.default_hash_method = hashlib.sha1
        elif algorithm == "sha224":
            self.default_hash_method = hashlib.sha224
        elif algorithm == "sha256":
            self.default_hash_method = hashlib.sha256
        elif algorithm == "sha384":
            self.default_hash_method = hashlib.sha384
        elif algorithm == "sha512":
            self.default_hash_method = hashlib.sha512
        else:
            raise WrongHashAlgorithmError("There's no algorithm names '%s'! "
                                          "use one of 'md5', 'sha1', 'sha224', "
                                          "'sha256', 'sha384', 'sha512'." % algorithm)
1080749
def create_user(self, name, password):
        """"""
        hashed_password = self._password_hasher(password)
        return dict(name=name, password=hashed_password)
180957
def create_user(self, user):
        
        self.run("useradd -m %s" % user)
        usr =  getpwnam(user)
        return usr
673694
def _create_entry(self, name, values, fbterm=False):
        ''' 
        '''
        if fbterm:
            attr = _PaletteEntryFBTerm(self, name.upper(), ';'.join(values))
        else:
            attr = _PaletteEntry(self, name.upper(), ';'.join(values))
        setattr(self, name, attr)  # now cached
        return attr
132386
def add(user_id, resource_policy, admin, inactive,  rate_limit):
    '''
    
    '''
    try:
        user_id = int(user_id)
    except ValueError:
        pass  # string-based user ID for Backend.AI v1.4+
    with Session() as session:
        try:
            data = session.KeyPair.create(
                user_id,
                is_active=not inactive,
                is_admin=admin,
                resource_policy=resource_policy,
                rate_limit=rate_limit)
        except Exception as e:
            print_error(e)
            sys.exit(1)
        if not data['ok']:
            print_fail('KeyPair creation has failed: {0}'.format(data['msg']))
            sys.exit(1)
        item = data['keypair']
        print('Access Key: {0}'.format(item['access_key']))
        print('Secret Key: {0}'.format(item['secret_key']))