aboutsummaryrefslogtreecommitdiffstats
path: root/include/security.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2016-01-18 07:31:37 +0100
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2016-01-18 07:31:37 +0100
commitdd3f69eaf357d6a43e087b0b8ed8402738cc39a5 (patch)
treeb6b1aa5903915d75ab74ee4f65a7868d53d6b036 /include/security.php
parentc4a14c27cf4ddff2f6225edc841f8cd53bbc7f44 (diff)
parentfc54f54b989570e2767a53c3c72875255b0dc95f (diff)
downloadvolse-hubzilla-dd3f69eaf357d6a43e087b0b8ed8402738cc39a5.tar.gz
volse-hubzilla-dd3f69eaf357d6a43e087b0b8ed8402738cc39a5.tar.bz2
volse-hubzilla-dd3f69eaf357d6a43e087b0b8ed8402738cc39a5.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/security.php')
-rw-r--r--include/security.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/include/security.php b/include/security.php
index d4ebe0024..2a9a6e39e 100644
--- a/include/security.php
+++ b/include/security.php
@@ -18,20 +18,13 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
+ $lastlog_updated = false;
+
if(x($user_record, 'account_id')) {
$a->account = $user_record;
$_SESSION['account_id'] = $user_record['account_id'];
$_SESSION['authenticated'] = 1;
- if($login_initial || $update_lastlog) {
- q("update account set account_lastlog = '%s' where account_id = %d",
- dbesc(datetime_convert()),
- intval($_SESSION['account_id'])
- );
- $a->account['account_lastlog'] = datetime_convert();
- call_hooks('logged_in', $a->account);
-
- }
$uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid'])))
? intval($_SESSION['uid'])
@@ -42,9 +35,19 @@ function authenticate_success($user_record, $login_initial = false, $interactive
change_channel($uid_to_load);
}
+ if($login_initial || $update_lastlog) {
+ q("update account set account_lastlog = '%s' where account_id = %d",
+ dbesc(datetime_convert()),
+ intval($_SESSION['account_id'])
+ );
+ $a->account['account_lastlog'] = datetime_convert();
+ $lastlog_updated = true;
+ call_hooks('logged_in', $a->account);
+ }
+
}
- if($login_initial) {
+ if(($login_initial) && (! $lastlog_updated)) {
call_hooks('logged_in', $user_record);