Skip to content

Commit 08688af

Browse files
committed
Fix OC.getCurrentUser() on guest pages
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent e7f0e8b commit 08688af

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

core/templates/layout.guest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<!DOCTYPE html>
22
<html class="ng-csp" data-placeholder-focus="false" lang="<?php p($_['language']); ?>" data-locale="<?php p($_['locale']); ?>" >
3-
<head data-requesttoken="<?php p($_['requesttoken']); ?>">
3+
<head
4+
<?php if ($_['user_uid']) { ?>
5+
data-user="<?php p($_['user_uid']); ?>" data-user-displayname="<?php p($_['user_displayname']); ?>"
6+
<?php } ?>
7+
data-requesttoken="<?php p($_['requesttoken']); ?>">
48
<meta charset="utf-8">
59
<title>
610
<?php p($theme->getTitle()); ?>

lib/private/TemplateLayout.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ public function __construct( $renderAs, $appId = '' ) {
122122
parent::__construct('core', 'layout.guest');
123123
\OC_Util::addStyle('guest');
124124
$this->assign('bodyid', 'body-login');
125+
126+
$userDisplayName = \OC_User::getDisplayName();
127+
$this->assign('user_displayname', $userDisplayName);
128+
$this->assign('user_uid', \OC_User::getUser());
125129
} else if ($renderAs == 'public') {
126130
parent::__construct('core', 'layout.public');
127131
$this->assign( 'appid', $appId );

0 commit comments

Comments
 (0)