src/Model/Behavior/UserBehavior.php
protected function _beforeRegister(EntityInterface $entity, $options = []) {
		$options = Hash::merge($this->_config['register'], $options);

		$schema = $this->_table->getSchema();
		$columnType = $schema->getColumnType($this->_table->getPrimaryKey());

		if ($this->_config['useUuid'] === true && $columnType !== 'integer') {
			$primaryKey = $this->_table->getPrimaryKey();
			$entity->set($primaryKey, Text::uuid());
		}

		if ($options['userActive'] === true) {
			$entity->set($this->_field('active'), true);
		}

		$this->_emailVerification($entity, $options);

		if (!isset($entity->{$this->_field('role')})) {
			$entity->set($this->_field('role'), $options['defaultRole']);
		}

		if ($options['generatePassword'] === true) {
			$password = $this->generatePassword();
			$entity->set($this->_field('password'), $password);
			$entity->set('clear_password', $password);
		}

		if ($options['hashPassword'] === true) {
			$entity->set($this->_field('password'), $this->hashPassword($entity->get($this->_field('password'))));
		}

		return $entity;
	}
protected function _beforeRegister(EntityInterface $entity, $options = []) {
		$options = Hash::merge($this->_config['register'], $options);

		$schema = $this->_table->getSchema();
		$columnType = $schema->getColumnType($this->_table->getPrimaryKey());

		if ($this->_config['useUuid'] === true && $columnType !== 'integer') {
			$primaryKey = $this->_table->getPrimaryKey();
			$entity->set($primaryKey, Text::uuid());
		}

		if ($options['userActive'] === true) {
			$entity->set($this->_field('active'), true);
		}

		$this->_emailVerification($entity, $options);

		if (!isset($entity->{$this->_field('role')})) {
			$entity->set($this->_field('role'), $options['defaultRole']);
		}

		if ($options['generatePassword'] === true) {
			$password = $this->generatePassword();
			$entity->set($this->_field('password'), $password);
			$entity->set('clear_password', $password);
		}

		if ($options['hashPassword'] === true) {
			$entity->set($this->_field('password'), $this->hashPassword($entity->get($this->_field('password'))));
		}

		return $entity;
	}
protected function _beforeRegister ( EntityInterface $ entity , $ options = [ ] ) { $ options = Hash :: merge ( $ this -> _config [ 'register' ] , $ options ) ; $ schema = $ this -> _table -> getSchema ( ) ; $ columnType = $ schema -> getColumnType ( $ this -> _table -> getPrimaryKey ( ) ) ; if ( $ this -> _config [ 'useUuid' ] === true && $ columnType !== 'integer' ) { $ primaryKey = $ this -> _table -> getPrimaryKey ( ) ; $ entity -> set ( $ primaryKey , Text :: uuid ( ) ) ; } if ( $ options [ 'userActive' ] === true ) { $ entity -> set ( $ this -> _field ( 'active' ) , true ) ; } $ this -> _emailVerification ( $ entity , $ options ) ; if ( ! isset ( $ entity -> { $ this -> _field ( 'role' ) } ) ) { $ entity -> set ( $ this -> _field ( 'role' ) , $ options [ 'defaultRole' ] ) ; } if ( $ options [ 'generatePassword' ] === true ) { $ password = $ this -> generatePassword ( ) ; $ entity -> set ( $ this -> _field ( 'password' ) , $ password ) ; $ entity -> set ( 'clear_password' , $ password ) ; } if ( $ options [ 'hashPassword' ] === true ) { $ entity -> set ( $ this -> _field ( 'password' ) , $ this -> hashPassword ( $ entity -> get ( $ this -> _field ( 'password' ) ) ) ) ; } return $ entity ; }
Behavior internal before registration callback

This method deals with most of the settings for the registration that can be
applied before the actual user record is saved.

@param \Cake\Datasource\EntityInterface $entity Users entity
@param array $options Options
@return \Cake\Datasource\EntityInterface
Behavior internal before registration callback