Skip to content
Snippets Groups Projects
class.auth.php 31.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • class ClientAcctConfirmationTokenBackend extends UserAuthenticationBackend {
        static $id = "confirm.client";
    
    
        function supportsInteractiveAuthentication() {
    
            return false;
        }
    
        function signOn($errors=array()) {
            global $ost;
    
            if (!isset($_GET['token']))
                return false;
            elseif (!($_config = new Config('pwreset')))
                return false;
            elseif (!($id = $_config->get($_GET['token'])))
                return false;
            elseif (!($acct = ClientAccount::lookup(array('user_id'=>$id)))
                    || !$acct->getId()
                    || $id != $acct->getUserId()
                    || !($client = new ClientSession(new EndUser($acct->getUser()))))
                return false;
            else
                return $client;
        }
    }
    UserAuthenticationBackend::register('ClientAcctConfirmationTokenBackend');