]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix OC.getCurrentUser() on guest pages 14178/head
authorJoas Schilling <coding@schilljs.com>
Wed, 13 Feb 2019 13:50:06 +0000 (14:50 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 19 Feb 2019 15:08:40 +0000 (16:08 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
core/templates/layout.guest.php
lib/private/TemplateLayout.php

index 39c7f83a3caf5d2468579879e43808222ce8b3ec..608ce03186cd0bba7f1ab811cc04d4b982e3cd73 100644 (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()); ?>
index e4a2724de67e075b5647d0f0c4bb912b137c1bd0..74578afe861cbd48c289bcc2b23a6d1c8a03d553 100644 (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 );