Login Dialog

	<xp:dojoModule name="dijit.Dialog"></xp:dojoModule>

<xp:link escape="true" id="banner_btn_login"
	styleClass="loginLink" text="Anmelden">
			var strLoginURL:String;
			var strLogoutURL:String;
			var contextPath = facesContext.getExternalContext().getRequest().getContextPath();
			var requestURI = facesContext.getExternalContext().getRequest().getRequestURI();

			strLoginURL = contextPath + "?login&redirectto=" + requestURI;
			strLogoutURL = contextPath + "?logout&redirectto=" + contextPath;
			return (@UserName() == "Anonymous")?true:false;}]]>
	<xp:eventHandler event="onclick"
<xp:link escape="true" id="banner_btn_logout" styleClass="loginLink"
	value="#{javascript:return strLogoutURL}" text="Abmelden">
			return (@UserName() == "Anonymous")?false:true;}]]>

<xp:div dojoType="dijit.Dialog" id="showLoginDialog"
	style="overflow:auto;" title="Anmelden">
		<xp:dojoAttribute name="href"
			value="#{javascript:strLoginURL}" />

Simply embedd this code somewhere in your XPage to have your login screen put into a dojo dialog.
I always put it into a link list on top of the screen like in OneUI or in a menu or something.

For anonymous users, the login link will be displayed and for any authorized user the logout link will be displayed.
Looks a bit more beautiful and more modern than a new screen with the login mask showing up. Of course this is only helpful if the application allows unauthorized users to open at least the start page.

I recommend using a customized login mask, defined in domcfg.nsf, in this dialog.


Matthias Nicklisch
April 18, 2012 4:18 PM

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.

No comments yetLogin first to comment...