setPassword Application Delegate Method

Optional method in application delegate class to override how to set the password via the change_password action.

You can throw an exception to disallow setting the password entirely.

Example:

function setPassword($password) {
    $user = $this->getLoggedInUser();
    if ( !$user ){
    
        throw new Exception("Failed to set password because there is no logged in user.");
    }
    
    $user->setValue($this->passwordColumn, $password);
    $res = $user->save();
    if ( PEAR::isError($res) ){
        throw new Exception($res->getMessage());
    }
    return true;
    
}