The AuthenticateUser function only seems to be called in the onclick Sign in button on the default.htm page.Here is the first part of the code for the loginpage.js within the Init function for the executive dashboard app:
var portal, portalUrl = document.location.protocol + '//www.arcgis.com';
var portalUser = null;
var share; //flag to determine whether the application is shared or not
function Init() {
esri.config.defaults.io.proxyUrl = "proxy.ashx";
esriConfig.defaults.io.alwaysUseProxy = false;
esriConfig.defaults.io.timeout = 180000;
// Create the portal
portal = new esri.arcgis.Portal(portalUrl);
// Set error messages from xml file
dojo.xhrGet({
url: "errorMessages.xml",
handleAs: "xml",
preventCache: true,
load: function (xmlResponse) {
messages = xmlResponse;
if (dojo.isIE < 9 || dojo.isFF <= 3.5 || dojo.isChrome <= 5 || dojo.isOpera <= 9.5 || dojo.isSafari <= 3.1) {
alert(messages.getElementsByTagName("browserSupport")[0].childNodes[0].nodeValue);
return;
}
share = GetQuerystring('extent');
if (share != "") {
dojo.dom.byId("divTextContainer").style.display = "none";
dojo.dom.byId("divMapContainer").style.display = "none";
ShowProgressIndicator();
portal.signIn().then(function (loggedInUser) {
portalUser = loggedInUser;
sessionStorage.clear();
FindArcGISGroup();
});
if (dojo.query(".dijitDialogPaneContentArea")[0]) {
dojo.query(".dijitDialogPaneContentArea")[0].childNodes[0].innerHTML = "Enter your Username and Password";
}
}
else {
dojo.dom.byId("divTextContainer").style.display = "block";
}
var userAgent = window.navigator.userAgent;
if ((userAgent.indexOf("iPad") >= 0) || (userAgent.indexOf("Android") >= 0)) {
isTablet = true;
dojo.dom.byId('dynamicStyleSheet').href = "styles/tablet.css";
}
else {
isBrowser = true;
dojo.dom.byId('dynamicStyleSheet').href = "styles/browser.css";
}
dojo.connect(window, 'onresize', function (evt) {
setTimeout(function () {
CreateScrollbar(dojo.dom.byId('divLayerContainer'), dojo.dom.byId('divLayerContent'));
}, 500);
if (map) {
if (dojo.dom.byId("map").style.display != "none") {
dojo.dom.byId('map').style.marginLeft = (dojo['dom-geometry'].getMarginBox("holder").l) + "px";
dojo.dom.byId('divFrozen').style.marginLeft = (dojo['dom-geometry'].getMarginBox("holder").l) + "px";
dojo.dom.byId('showHide').style.right = (dojo['dom-geometry'].getMarginBox("holder").l + 15) + "px";
ToggleContainers();
map.reposition();
map.resize();
ResetSlideControls();
dojo.dom.byId("divTempMap").style.left = ((dojo['dom-geometry'].getMarginBox("mapContainer").w + (dojo['dom-geometry'].getMarginBox("holder").l)) - dojo['dom-geometry'].getMarginBox("divMap").w) + "px";
setTimeout(function () {
dojo.dom.byId("divFrozen").style.height = (map.height - 140) + "px";
}, 500);
ResizeChartContainer();
}
}
});