Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
5a85c174
Commit
5a85c174
authored
Nov 28, 2016
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (login/register)
parent
268cd3fb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
login.php
qa-include/pages/login.php
+8
-5
logout.php
qa-include/pages/logout.php
+8
-5
register.php
qa-include/pages/register.php
+8
-5
No files found.
qa-include/pages/login.php
View file @
5a85c174
...
@@ -26,16 +26,19 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
...
@@ -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
(
''
);
qa_redirect
(
''
);
}
// Check we're not using Q2A's single-sign on integration and that we're not logged in
// Check we're not using Q2A's single-sign on integration and that we're not logged in
if
(
QA_FINAL_EXTERNAL_USERS
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$request
=
qa_request
();
$request
=
qa_request
();
$topath
=
qa_get
(
'to'
);
// lets user switch between login and register without losing destination page
$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
,
''
));
$userlinks
=
qa_get_login_links
(
qa_path_to_root
(),
isset
(
$topath
)
?
$topath
:
qa_path
(
$request
,
$_GET
,
''
));
if
(
!
empty
(
$userlinks
[
'login'
]))
if
(
!
empty
(
$userlinks
[
'login'
]))
{
qa_redirect_raw
(
$userlinks
[
'login'
]);
qa_redirect_raw
(
$userlinks
[
'login'
]);
}
qa_fatal_error
(
'User login should be handled by external code'
);
qa_fatal_error
(
'User login should be handled by external code'
);
}
}
...
...
qa-include/pages/logout.php
View file @
5a85c174
...
@@ -27,15 +27,18 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
...
@@ -27,15 +27,18 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
if
(
QA_FINAL_EXTERNAL_USERS
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$request
=
qa_request
();
$request
=
qa_request
();
$topath
=
qa_get
(
'to'
);
// lets user switch between login and register without losing destination page
$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
,
''
));
$userlinks
=
qa_get_login_links
(
qa_path_to_root
(),
isset
(
$topath
)
?
$topath
:
qa_path
(
$request
,
$_GET
,
''
));
if
(
!
empty
(
$userlinks
[
'logout'
]))
if
(
!
empty
(
$userlinks
[
'logout'
]))
{
qa_redirect_raw
(
$userlinks
[
'logout'
]);
qa_redirect_raw
(
$userlinks
[
'logout'
]);
}
qa_fatal_error
(
'User logout should be handled by external code'
);
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_set_logged_in_user
(
null
);
}
qa_redirect
(
''
);
// back to home page
qa_redirect
(
''
);
// back to home page
qa-include/pages/register.php
View file @
5a85c174
...
@@ -29,16 +29,19 @@ require_once QA_INCLUDE_DIR . 'app/captcha.php';
...
@@ -29,16 +29,19 @@ require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
if
(
qa_is_logged_in
())
if
(
qa_is_logged_in
())
{
qa_redirect
(
''
);
qa_redirect
(
''
);
}
// Check we're not using single-sign on integration, that we're not logged in, and we're not blocked
// 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
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$request
=
qa_request
();
$request
=
qa_request
();
$topath
=
qa_get
(
'to'
);
// lets user switch between login and register without losing destination page
$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
,
''
));
$userlinks
=
qa_get_login_links
(
qa_path_to_root
(),
isset
(
$topath
)
?
$topath
:
qa_path
(
$request
,
$_GET
,
''
));
if
(
!
empty
(
$userlinks
[
'register'
]))
if
(
!
empty
(
$userlinks
[
'register'
]))
{
qa_redirect_raw
(
$userlinks
[
'register'
]);
qa_redirect_raw
(
$userlinks
[
'register'
]);
}
qa_fatal_error
(
'User registration should be handled by external code'
);
qa_fatal_error
(
'User registration should be handled by external code'
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment