src/Shell/UserShell.php
public function setPassword() {
		if (count($this->args) < 2) {
			$this->abort(__d('burzum/user_tools', 'You need to call this command with at least tow arguments.'));
		}

		$field = 'username';
		if (count($this->args) >= 3) {
			$field = $this->args[2];
		}

		$user = $this->UserTable->find()->where([$field => $this->args[0]])->first();
		$user->password = $this->UserTable->hashPassword($this->args[1]);
		if ($this->UserTable->save($user, ['validate' => false])) {
			$this->out('Password saved');
		}
	}
public function setPassword() {
		if (count($this->args) < 2) {
			$this->abort(__d('burzum/user_tools', 'You need to call this command with at least tow arguments.'));
		}

		$field = 'username';
		if (count($this->args) >= 3) {
			$field = $this->args[2];
		}

		$user = $this->UserTable->find()->where([$field => $this->args[0]])->first();
		$user->password = $this->UserTable->hashPassword($this->args[1]);
		if ($this->UserTable->save($user, ['validate' => false])) {
			$this->out('Password saved');
		}
	}
public function setPassword ( ) { if ( count ( $ this -> args ) < 2 ) { $ this -> abort ( __d ( 'burzum/user_tools' , 'You need to call this command with at least tow arguments.' ) ) ; } $ field = 'username' ; if ( count ( $ this -> args ) >= 3 ) { $ field = $ this -> args [ 2 ] ; } $ user = $ this -> UserTable -> find ( ) -> where ( [ $ field => $ this -> args [ 0 ] ] ) -> first ( ) ; $ user -> password = $ this -> UserTable -> hashPassword ( $ this -> args [ 1 ] ) ; if ( $ this -> UserTable -> save ( $ user , [ 'validate' => false ] ) ) { $ this -> out ( 'Password saved' ) ; } }
Sets a new password for an user.

cake user setPassword <searchTerm> <newPassword> <field | optional>

@return void
Sets a new password for an user .