} return Xysti::success_redirect(); // Registration failed.. } else { Session::flash('warning', 'Registration failed'); } return Xysti::make(); })); } /** * Activate a new user and log them in * @todo Finish email authentication mechanism */ if (FALSE && Config::get('xysti.routes.auth.activate')) { Route::get('activate/(:any)/(:any)', function () { Xysti::helper('dbug'); $auth_driver = Config::get('xysti.auth', 'default'); // Default auth if ($auth_driver == 'default') { Xysti::error(500, 'Default auth currently not configured for activation.'); // Sentry auth } elseif ($auth_driver == 'sentry') { try { $activate_user = Sentry::activate_user(URI::segment(2), URI::segment(3), FALSE); } catch (Sentry\SentryException $e) { // issue activating the user // store/set and display caught exceptions such as a suspended user with limit attempts feature. $errors = $e->getMessage(); } } else { return Xysti::error(500, 'Unknown authentication driver.');
/** * Error controller * * Render a view for an error code * @param int $file Optional HTTP status */ public static function error($error_code, $reason = NULL) { $errors = Config::get('xysti.errors'); if (isset($errors[$error_code])) { $error = $errors[$error_code]; $error['code'] = $error_code; } else { $error = $errors['generic']; $error['code'] = 'Generic'; } Log::write('error', 'Error ' . $error['code'] . ' at ' . URI::current() . '. ' . $reason); if (View::exists('content.misc.error')) { Xysti::$views['content'] = 'content.misc.error'; Xysti::$data['error'] = $error; } else { Xysti::helper('template'); Xysti::$content = page_title(array('echo' => FALSE, 'title' => $error['title'], 'caption' => $error['code'])) . PHP_EOL . $error['content']; } $view = View::make(Config::get('xysti.template')); if ($error['code'] == 'Generic') { return $view; } else { return Response::make($view, $error['code']); } }