[Owncloud] How to add JavaScript file to the guest login page

Christian Reiner foss at christian-reiner.info
Sun Jun 23 12:23:19 UTC 2013


On Sunday 23 June 2013 11:56:07 Lukas Reschke wrote:
> You can perform a check whether the user is logged in in appinfo/app.php
> and if the user is not logged in add the script. - Please be aware that
> this script will be added to any page that the guest accesses. (e.g. the
> file share view)
> 
> App Framework:
> > if (!$api->isLoggedIn()) {
> > 
> >      $api->addScript('public/login');
> > 
> > }
> 
> ownCloud API:
> > if(!\OC_User::isLoggedIn()) {
> > 
> >       \OCP\Util::addscript('appname', 'public/login');
> > 
> > }

I asked about a solution for this myself some weeks ago and did not come to a 
solution with the current OC core... And if I am not totally mistaken your 
suggestion does not work too, Lukas: 
the problem is that on the login page (guest template view) _no_ app is 
loaded. So there simply is no hook for an app developer to act. This is why I 
suggested to introduce an additional app category ("public" or something). 
Apps marked for this category would _always_ be loaded by OC, regardless of 
which tempalte view is used. 

Christian Reiner (arkascha)



More information about the Owncloud mailing list