Commit 5a85c174 by Scott

Coding style (login/register)

parent 268cd3fb
......@@ -26,16 +26,19 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
}
if (qa_is_logged_in())
if (qa_is_logged_in()) {
qa_redirect('');
}
// Check we're not using Q2A's single-sign on integration and that we're not logged in
if (QA_FINAL_EXTERNAL_USERS) {
$request=qa_request();
$topath=qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks=qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['login']))
$request = qa_request();
$topath = qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['login'])) {
qa_redirect_raw($userlinks['login']);
}
qa_fatal_error('User login should be handled by external code');
}
......
......@@ -27,15 +27,18 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
if (QA_FINAL_EXTERNAL_USERS) {
$request=qa_request();
$topath=qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks=qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['logout']))
$request = qa_request();
$topath = qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['logout'])) {
qa_redirect_raw($userlinks['logout']);
}
qa_fatal_error('User logout should be handled by external code');
}
if (qa_is_logged_in())
if (qa_is_logged_in()) {
qa_set_logged_in_user(null);
}
qa_redirect(''); // back to home page
......@@ -29,16 +29,19 @@ require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR . 'db/users.php';
if (qa_is_logged_in())
if (qa_is_logged_in()) {
qa_redirect('');
}
// Check we're not using single-sign on integration, that we're not logged in, and we're not blocked
if (QA_FINAL_EXTERNAL_USERS) {
$request=qa_request();
$topath=qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks=qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['register']))
$request = qa_request();
$topath = qa_get('to'); // lets user switch between login and register without losing destination page
$userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
if (!empty($userlinks['register'])) {
qa_redirect_raw($userlinks['register']);
}
qa_fatal_error('User registration should be handled by external code');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment