Current Record: setPassword #187

Optional method in application delegate class to override how to set the password via the change_password action. You can throw an exceptio...

Current Record: setPassword #187

Optional method in application delegate class to override how to set the password via the change_password action. You can throw an exceptio...

setPassword Application Delegate Method

[Permalink]

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;
    
}
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved