Exemplo n.º 1
0
 public function register()
 {
     $this->app->bind('oauth/factory/service', function ($app, $params = array()) {
         $factory = new ServiceFactory();
         $factory->setHttpClient($client = new CurlClient());
         $client->setCurlParameters((array) $params);
         return $factory;
     });
     $this->app->bindShared('oauth/factory/extractor', function () {
         return new ExtractorFactory();
     });
     $this->app->bind('oauth_extractor', function ($app, $params = array()) {
         if (!is_array($params)) {
             $params = array($params);
         }
         if (!($service = head($params))) {
             throw new \InvalidArgumentException('No Service given.');
         }
         $extractor_factory = $app->make('oauth/factory/extractor');
         return $extractor_factory->get($service);
     });
     \Route::register('/ccm/system/authentication/oauth2/{type}/{action}', function ($type, $action) {
         try {
             $type = \AuthenticationType::getByHandle($type);
             if ($type && is_object($type) && !$type->isError()) {
                 /** @var GenericOauthTypeController $controller */
                 $controller = $type->getController();
                 if ($controller instanceof GenericOauthTypeController) {
                     switch ($action) {
                         case 'attempt_auth':
                             return $controller->handle_authentication_attempt();
                             break;
                         case 'callback':
                             return $controller->handle_authentication_callback();
                             break;
                         case 'attempt_attach':
                             return $controller->handle_attach_attempt();
                             break;
                         case 'attach_callback':
                             return $controller->handle_attach_callback();
                             break;
                     }
                 }
             }
         } catch (\Exception $e) {
             \Log::addNotice('OAUTH ERROR: ' . $e->getMessage());
         }
     });
 }
Exemplo n.º 2
0
}
?>

<!-- user login -->
<?php 
if (!$u->isLoggedIn()) {
    ?>
  <div class="row customer-login-toggle-wrap">
    <div class="col-xs-12">
      <!-- if user not logged in we provide them with login form -->
      <div class="customer-login-toggle">
        Returning customer? Click here to login >>
      </div>
      <div class="customer-login-form-wrap">
        <?php 
    $standardAuth = AuthenticationType::getByHandle('concrete');
    $standardAuth->renderForm($authTypeElement ?: 'form', $authTypeParams ?: array());
    ?>
      </div>
    </div>
  </div>
<?php 
}
?>

<!-- open checkout form -->
<form action="<?php 
print $form->action('/checkout/pay');
?>
" id="checkout-form" method="post">
  <?php