Service Portal Header - user.logged_in always has True value??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 04:10 AM
Hello,
In Service Portal Header there is somme conditions on this variable "user.logged_in" to show or hide specific content :
- <ul ng-if="::user.logged_in" class="nav navbar-nav">
- <!-- chat, avatar, and logout -->
- <li ng-if="::data.connect_support_queue_id"><a href ng-click="openPopUp()">${Live Chat}</a></li>
- <li class="dropdown hidden-xs">
- <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
- <span class="navbar-avatar"><sn-avatar class="avatar-small-medium" primary="userID" /></span>
- <span class="visible-lg-inline">{{::user.name}}</span>
- </a>
- <ul class="dropdown-menu">
- <li><a ng-href="?id=user_profile&sys_id={{::user.sys_id}}">${Profile}</a></li>
- <li><a href="{{::portal.logoutUrl}}">${Logout}</a></li>
- </ul>
- </li>
- <li class="visible-xs-block"><a ng-href="?id=user_profile&sys_id={{::user.sys_id}}">
- <span class="navbar-avatar"><sn-avatar class="avatar-small-medium" primary="userID" /></span>{{::user.name}}</a></li>
- <li class="visible-xs-block"><a href="{{::portal.logoutUrl}}">${Logout}</a></li>
- </ul>
But the content is always shown and when I check the value of this variable user.logged_in i see that it is always on True, although the user is logged out.
I checked also the controller of the header and the variable user.logged_in is not defined there.
Does any one faced this kind of issue before ??
thank you !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 09:02 PM
Hi Abdel Moumene,
I have the same this issue when I try to use the customize login page.
And this is my code was changed for header widget:
(replace user.logged_in by user.sys_id )
<ul ng-if="::(!user.sys_id && page.id != portal.login_page_dv && !data.hasLogin)" class="nav navbar-nav">
<li>
<a href ng-click="openLogin()">${Login}</a>
</li>
</ul>
<ul ng-if="::user.sys_id" class="nav navbar-nav">
<!-- chat, avatar, and logout -->
<li ng-if="::data.connect_support_queue_id">
<a href ng-click="openPopUp()">${Live Chat}</a>
</li>
<li class="dropdown hidden-xs">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
<span class="navbar-avatar">
<sn-avatar class="avatar-small-medium" primary="userID" />
</span>
<span class="visible-lg-inline">{{::user.name}}</span>
</a>
<ul class="dropdown-menu">
<li>
<a ng-href="?id=user_profile&sys_id={{::user.sys_id}}">${Profile}</a>
</li>
<li>
<a href="{{::portal.logoutUrl}}">${Logout}</a>
</li>
</ul>
</li>
<li class="visible-xs-block">
<a ng-href="?id=user_profile&sys_id={{::user.sys_id}}">
<span class="navbar-avatar">
<sn-avatar class="avatar-small-medium" primary="userID" />
</span>{{::user.name}}
</a>
</li>
<li class="visible-xs-block">
<a href="{{::portal.logoutUrl}}">${Logout}</a>
</li>
</ul>
It's work for me. You can try it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 02:25 AM
Hi Jack,
Thank you for your proposition i guess it will work as the user sys_id doesn't exist when the user is not logged in.
Actually I have resolved the issue by using gs.isLoggedIn() function in the server script :
- //Server Script
- //check if the user is logged in
- data.isUserLoggedIn= gs.isLoggedIn();
Then in the Body Html Template I replaced user.logged_in by data.isUserLoggedIn.
- //Body Html template
- <ul ng-if="::data.isUserLoggedIn" class="nav navbar-nav">
The second way if you want to keep using user.logged_in is to set its value on the controller :
- //Controller
- $scope.user.logged_in = $scope.data.isUserLoggedIn;
- //Body Html template
- <ul ng-if="::user.logged_in" class="nav navbar-nav">