public function changePassword($data) {
    if (!isset($data['password']) || (string) $data['password'] === '') {
      return ['result' => false, 'message' => 'Please specify a password.'];
    }
    if (!$this->checkPassword($data['oldPassword'])) {
      return ['result' => false, 'message' => 'Incorrect password.'];
    }
    $this->passwordTemp = (string) $data['password'];
    if ($this->save()) {
      return ['result' => true, 'message' => 'Your password has been changed.'];
    } else {
      return ['result' => false, 'message' => 'Couldn\'t save new password.'];
    }
  }
public function changePassword($data) {
    if (!isset($data['password']) || (string) $data['password'] === '') {
      return ['result' => false, 'message' => 'Please specify a password.'];
    }
    if (!$this->checkPassword($data['oldPassword'])) {
      return ['result' => false, 'message' => 'Incorrect password.'];
    }
    $this->passwordTemp = (string) $data['password'];
    if ($this->save()) {
      return ['result' => true, 'message' => 'Your password has been changed.'];
    } else {
      return ['result' => false, 'message' => 'Couldn\'t save new password.'];
    }
  }
public function changePassword ( $ data ) { if ( ! isset ( $ data [ 'password' ] ) || ( string ) $ data [ 'password' ] === '' ) { return [ 'result' => false , 'message' => 'Please specify a password.' ] ; } if ( ! $ this -> checkPassword ( $ data [ 'oldPassword' ] ) ) { return [ 'result' => false , 'message' => 'Incorrect password.' ] ; } $ this -> passwordTemp = ( string ) $ data [ 'password' ] ; if ( $ this -> save ( ) ) { return [ 'result' => true , 'message' => 'Your password has been changed.' ] ; } else { return [ 'result' => false , 'message' => 'Couldn\'t save new password.' ] ; } }
A frontend accessible method to change the user's password.

@return array An associative array with a boolean 'result' entry and a
'message' entry.
A frontend accessible method to change the user s password .