src/Auth/DefaultAuthSetupTrait.php
public function setupAuthentication() {
		if (!in_array('Auth', $this->components()->loaded())) {
			$this->components()->load('Auth');
		}

		$this->components()->Auth->setConfig('authenticate', [
			'Form' => [
				'userModel' => 'Users',
				'fields' => [
					'username' => 'email',
					'password' => 'password'
				],
				'scope' => [
					'Users.email_verified' => 1
				]
			]
		]);
	}
public function setupAuthentication() {
		if (!in_array('Auth', $this->components()->loaded())) {
			$this->components()->load('Auth');
		}

		$this->components()->Auth->setConfig('authenticate', [
			'Form' => [
				'userModel' => 'Users',
				'fields' => [
					'username' => 'email',
					'password' => 'password'
				],
				'scope' => [
					'Users.email_verified' => 1
				]
			]
		]);
	}
public function setupAuthentication ( ) { if ( ! in_array ( 'Auth' , $ this -> components ( ) -> loaded ( ) ) ) { $ this -> components ( ) -> load ( 'Auth' ) ; } $ this -> components ( ) -> Auth -> setConfig ( 'authenticate' , [ 'Form' => [ 'userModel' => 'Users' , 'fields' => [ 'username' => 'email' , 'password' => 'password' ] , 'scope' => [ 'Users.email_verified' => 1 ] ] ] ) ; }
Sets the default authentication settings up.

Call this in your beforeFilter().

@return void
Sets the default authentication settings up .