Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

As simple as a login page can be:

Code Block
xml
xml
titlewebskin/farLogin/displayHeaderLogin.cfmxml
<cfsetting enablecfoutputonly="true">

<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head> 
		<title>#application.config.general.siteTitle# :: #application.applicationname#</title>
	</head>
	<body style="width:960px;margin:0 auto;">
		<h1>Login</h1>
</cfoutput>

<cfsetting enablecfoutputonly="false">
Code Block
xml
xml
titlewebskin/farLogin/displayFooterLogin.cfmxml
<cfsetting enablecfoutputonly="true">

<cfoutput>
	</body>
</html>
</cfoutput>

<cfsetting enablecfoutputonly="false">

...

Remember - this page is used for every login unless you specify a different public login page.

Code Block
xml
xml
titlewebskin/farLogin/displayLogin.cfmxml
<cfsetting enablecfoutputonly="true">

<cfimport taglib="/farcry/core/tags/formtools/" prefix="ft" />

<cfoutput>
<html>
	<body>
		<ft:form>
			<ft:object typename="farLogin" lFields="username,password" prefix="login" legend="" focusField="username" />
			<ft:button value="Log In" />
		</ft:form>
	</body>
</html>
</cfoutput>

<cfsetting enablecfoutputonly="false">

...

Leave the webtop login as it is, but override the login page used for accessing restricted content.

Code Block
xml
xml
titleconfig/_serverSpecificVarsAfterInit.cfmxml
<cfset application.url.publiclogin = application.fapi.getLink(type="farLogin",view="displayPageStandard") />
Code Block
xml
xml
titlewebskin/farLogin/displayPageStandard.cfmxml
<cfsetting enablecfoutputonly="true">

<cfimport taglib="/farcry/core/tags/formtools/" prefix="ft" />

<cfset stLocal.stResult = application.security.processLogin() />

<cfif stLocal.stResult.authenticated>
	<cflocation url="#URLDecode(stLocal.stResult.loginReturnURL)#" addtoken="false" />
</cfif>

<cfoutput>
<html>
	<body>
		<ft:form>
			<ft:object typename="farLogin" lFields="username,password" prefix="login" legend="" focusField="username" />
			<ft:button value="Log In" />
		</ft:form>
	</body>
</html>
</cfoutput>

<cfsetting enablecfoutputonly="false">

Inline Login Pod

Code Block
xml
xml
titleconfig/_serverSpecificRequestScope.cfmxml
<cfset stLocal.stResult = application.security.processLogin() />
Code Block
xml
xml
titlewebskin/dmProfile/displayUserInfo.cfmxml
<cfsetting enablecfoutputonly="true">
<!--- @@cacheStatus: -1 --->

<cfimport taglib="/farcry/core/tags/formtools/" prefix="ft" />

<cfoutput>
	<cfif application.fapi.isLoggedIn()>
		<p>Welcome #session.dmProfile.firstname# #session.dmProfile.lastname#. <a href="/?logout=1">Logout</a></p>
	<cfelse>
		<ft:form>
			<ft:object typename="farLogin" lFields="username,password" prefix="login" legend="" focusField="username" />
			<ft:button value="Log In" />
		</ft:form>
	</cfif>
</cfoutput>

<cfsetting enablecfoutputonly="false">
Code Block
xml
xml
titlewebskin/types/displayHeaderStandard.cfmxml
...
<skin:view typename="dmProfile" webskin="displayUserInfo" />
...

...

Notice that this approach will redirect to home in most cases as the ajaxed form does not know what the parent page is.

Code Block
xml
xml
titleconfig/_serverSpecificVarsAfterInit.cfmxml
<cfset application.url.publiclogin = application.url.webroot />
Code Block
xml
xml
titlewebskin/dmProfile/displayUserInfo.cfmxml
<cfsetting enablecfoutputonly="true">
<!--- @@cacheStatus: -1 --->

<cfimport taglib="/farcry/core/tags/formtools/" prefix="ft" />

<cfif not application.security.isLoggedIn()>
	<cfset stResult = application.security.processLogin() />
	<cfif stResult.authenticated>
		<cfoutput><script type="text/javascript">window.location.href='#session.loginReturnURL#';</script></cfoutput>
	</cfif>
</cfif>

<cfoutput>
	<cfif application.security.isLoggedIn()>
		<p>Welcome #session.dmProfile.firstname# #session.dmProfile.lastname#. <a href="/?logout=1">Logout</a></p>
	<cfelse>
		<ft:form bAjaxSubmission="true">
			<ft:object typename="farLogin" lFields="username,password" prefix="login" legend="" focusField="username" />
			<ft:button value="Log In" />
		</ft:form>
	</cfif>
</cfoutput>

<cfsetting enablecfoutputonly="false">
Code Block
xml
xml
titlewebskin/types/displayHeaderStandard.cfmxml
...
<skin:view typename="dmProfile" webskin="displayUserInfo" bAjax="true" ajaxURLParameters="returnURL=#urlencodedformat(application.fapi.fixURL())#" />
...