Beispiel #1
0
 function getAuthBackend()
 {
     list($authkey, ) = explode(':', $this->getAuthKey());
     return UserAuthenticationBackend::getBackend($authkey);
 }
Beispiel #2
0
        if (!$cfg->isClientEmailVerificationRequired()) {
            Http::redirect('tickets.php');
        }
        // We're using authentication backend so we can guard aganist brute
        // force attempts (which doesn't buy much since the link is emailed)
        $user->sendAccessLink();
        $msg = sprintf(__("%s - access link sent to your email!"), Format::htmlchars($user->getName()->getFirst()));
        $_POST = null;
    } elseif (!$errors['err']) {
        $errors['err'] = __('Invalid email or ticket number - try again!');
    }
} elseif (isset($_GET['do'])) {
    switch ($_GET['do']) {
        case 'ext':
            // Lookup external backend
            if ($bk = UserAuthenticationBackend::getBackend($_GET['bk'])) {
                $bk->triggerAuth();
            }
    }
} elseif ($user = UserAuthenticationBackend::processSignOn($errors, false)) {
    // Users from the ticket access link
    if ($user && $user instanceof TicketUser && $user->getTicketId()) {
        Http::redirect('tickets.php?id=' . $user->getTicketId());
    } elseif ($user instanceof ClientCreateRequest) {
        if ($cfg && $cfg->isClientRegistrationEnabled()) {
            // Attempt to automatically register
            if ($user->attemptAutoRegister()) {
                Http::redirect('tickets.php');
            }
            // Unable to auto-register. Fill in what we have and let the
            // user complete the info
Beispiel #3
0
 } else {
     if (!($acct = ClientAccount::createForUser($user))) {
         $errors['err'] = __('Internal error. Unable to create new account');
     } elseif (!$acct->update($_POST, $errors)) {
         $errors['err'] = __('Errors configuring your profile. See messages below');
     }
 }
 if (!$errors) {
     switch ($_POST['do']) {
         case 'create':
             $content = Page::lookup(Page::getIdByType('registration-confirm'));
             $inc = 'register.confirm.inc.php';
             $acct->sendConfirmEmail();
             break;
         case 'import':
             if ($bk = UserAuthenticationBackend::getBackend($_POST['backend'])) {
                 $cl = new ClientSession(new EndUser($user));
                 if (!$bk->supportsInteractiveAuthentication()) {
                     $acct->set('backend', null);
                 }
                 $acct->confirm();
                 if ($user = $bk->login($cl, $bk)) {
                     Http::redirect('tickets.php');
                 }
             }
             break;
     }
 }
 if ($errors && $user && $user != $thisclient) {
     $user->delete();
 }
Beispiel #4
0
            </span>
            </div>
<?php 
        }
        ?>
        </a><?php 
    }
    function triggerAuth()
    {
        $_SESSION['ext:bk:class'] = get_class($this);
    }
}
Signal::connect('api', function ($dispatcher) {
    $dispatcher->append(url('^/auth/ext$', function () {
        if ($class = $_SESSION['ext:bk:class']) {
            $bk = StaffAuthenticationBackend::getBackend($class::$id) ?: UserAuthenticationBackend::getBackend($class::$id);
            if ($bk instanceof ExternalAuthentication) {
                $bk->triggerAuth();
            }
        }
    }));
});
abstract class UserAuthenticationBackend extends AuthenticationBackend
{
    private static $_registry = array();
    static function _register($class)
    {
        static::$_registry[$class::$id] = $class;
    }
    static function allRegistered()
    {