Service Portal Widget Show/Hide Based on User Authentication

Widget

Creator: @ben-meeker

Following these steps allow you to show/hide a widget based on whether or not a user is signed in.

Getting Started

HTML Template

<!-- Example div -->
<div ng-if="!data.loggedin" class="card" onclick="location.href='https://some-link.com';"> 
  <p class="card-details">
    Sign into portal
  </p>
</div>

Client Script

api.controller=function() {
  /* widget controller */
  var c = this;
};

Server Script

(function() {
    /* populate the 'data' object */
    /* e.g., data.table = $sp.getValue('table'); */

    data.loggedin = gs.isLoggedIn();
	
})();