- $a->identities = User::identities($masterUid);
-
- if ($login_initial) {
- $a->getLogger()->info('auth_identities: ' . print_r($a->identities, true));
- }
-
- if ($login_refresh) {
- $a->getLogger()->info('auth_identities refresh: ' . print_r($a->identities, true));
- }
-
- $contact = DBA::selectFirst('contact', [], ['uid' => $user_record['uid'], 'self' => true]);
- if (DBA::isResult($contact)) {
- $a->contact = $contact;
- $a->cid = $contact['id'];
- self::set('cid', $a->cid);
- }
-
- header('X-Account-Management-Status: active; name="' . $user_record['username'] . '"; id="' . $user_record['nickname'] . '"');
-
- if ($login_initial || $login_refresh) {
- DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $user_record['uid']]);
-
- // Set the login date for all identities of the user
- DBA::update('user', ['login_date' => DateTimeFormat::utcNow()],
- ['parent-uid' => $masterUid, 'account_removed' => false]);
- }
-
- if ($login_initial) {
- /*
- * If the user specified to remember the authentication, then set a cookie
- * that expires after one week (the default is when the browser is closed).
- * The cookie will be renewed automatically.
- * The week ensures that sessions will expire after some inactivity.
- */
- ;
- if (self::get('remember')) {
- $a->getLogger()->info('Injecting cookie for remembered user ' . $user_record['nickname']);
- Authentication::setCookie(604800, $user_record);
- self::remove('remember');
- }
- }