summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorRico Sonntag <rico.sonntag@netresearch.de>2018-02-21 09:58:52 +0100
committerGreg Roach <fisharebest@gmail.com>2018-02-21 15:29:16 +0000
commitee7980d6722aeae245cae989abab659e19b0ad38 (patch)
tree6f6e011d6941056fe604f40fe46918940e121c36 /includes
parent5caba4566cf6297b684c1826cf7759df195ed208 (diff)
downloadwebtrees-ee7980d6722aeae245cae989abab659e19b0ad38.tar.gz
webtrees-ee7980d6722aeae245cae989abab659e19b0ad38.tar.bz2
webtrees-ee7980d6722aeae245cae989abab659e19b0ad38.zip
Fixed admin only login with private tree
Diffstat (limited to 'includes')
-rw-r--r--includes/session.php21
1 files changed, 4 insertions, 17 deletions
diff --git a/includes/session.php b/includes/session.php
index 08a19c4423..5adbfff9ed 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -256,23 +256,10 @@ define('WT_TIMESTAMP_OFFSET', date_offset_get(new DateTime('now')));
define('WT_CLIENT_JD', 2440588 + (int) ((WT_TIMESTAMP + WT_TIMESTAMP_OFFSET) / 86400));
-// If there is no current tree and we need one, then redirect somewhere
-if (WT_SCRIPT_NAME != 'admin_trees_manage.php' && WT_SCRIPT_NAME != 'admin_pgv_to_wt.php' && Filter::get('route') !== 'login' && Filter::get('route') !== 'logout' && WT_SCRIPT_NAME != 'import.php' && WT_SCRIPT_NAME != 'help_text.php' && WT_SCRIPT_NAME != 'action.php') {
- if (!$WT_TREE || !$WT_TREE->getPreference('imported')) {
- if (Auth::isAdmin()) {
- header('Location: admin_trees_manage.php');
- } else {
- // We're not an administrator, so we can only log in if there is a tree.
- if (Auth::id()) {
- Auth::logout();
- FlashMessages::addMessage(
- I18N::translate('This user account does not have access to any tree.')
- );
- }
- header('Location: ' . route('login', ['url' => $request->getRequestUri()]));
- }
- exit;
- }
+// Redirect to login url
+if (!$WT_TREE && !Auth::check() && WT_SCRIPT_NAME !== 'index.php') {
+ header('Location: ' . route('login', ['url' => $request->getRequestUri()]));
+ exit;
}
// Update the last-login time no more than once a minute