Merge pull request #14178 from nextcloud/bugfix/noid/get-current-user-for-guest-pages

Fix OC.getCurrentUser() on guest pages
This commit is contained in:
Morris Jobke 2019-02-20 13:21:39 +01:00 committed by GitHub
commit 82625e2a45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -1,6 +1,10 @@
<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="<?php p($_['language']); ?>" data-locale="<?php p($_['locale']); ?>" >
<head data-requesttoken="<?php p($_['requesttoken']); ?>">
<head
<?php if ($_['user_uid']) { ?>
data-user="<?php p($_['user_uid']); ?>" data-user-displayname="<?php p($_['user_displayname']); ?>"
<?php } ?>
data-requesttoken="<?php p($_['requesttoken']); ?>">
<meta charset="utf-8">
<title>
<?php p($theme->getTitle()); ?>

View file

@ -122,6 +122,10 @@ class TemplateLayout extends \OC_Template {
parent::__construct('core', 'layout.guest');
\OC_Util::addStyle('guest');
$this->assign('bodyid', 'body-login');
$userDisplayName = \OC_User::getDisplayName();
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', \OC_User::getUser());
} else if ($renderAs == 'public') {
parent::__construct('core', 'layout.public');
$this->assign( 'appid', $appId );