Commit 268cd3fb by Larry Lewis Committed by Scott

Issue #447 handle login, logout & register page calls when external auth is enabled

parent fb15e16f
......@@ -26,14 +26,19 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
}
// Check we're not using Q2A's single-sign on integration and that we're not logged in
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User login is handled by external code');
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']))
qa_redirect_raw($userlinks['login']);
qa_fatal_error('User login should be handled by external code');
}
// Process submitted form after checking we haven't reached rate limit
......
......@@ -26,8 +26,14 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
}
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User logout is handled by external code');
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']))
qa_redirect_raw($userlinks['logout']);
qa_fatal_error('User logout should be handled by external code');
}
if (qa_is_logged_in())
qa_set_logged_in_user(null);
......
......@@ -29,14 +29,19 @@ require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR . 'db/users.php';
// 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)
qa_fatal_error('User registration is handled by external code');
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']))
qa_redirect_raw($userlinks['register']);
qa_fatal_error('User registration should be handled by external code');
}
// Get information about possible additional fields
......
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