Login Pages

 

Reskining the Webtop Login Page

As simple as a login page can be:

webskin/farLogin/displayHeaderLogin.cfm
<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">
webskin/farLogin/displayFooterLogin.cfm
<cfsetting enablecfoutputonly="true">

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

<cfsetting enablecfoutputonly="false">

 

Completely Custom Webtop Login Page

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

webskin/farLogin/displayLogin.cfm
<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">

Separate Public and Webtop Login Pages

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

config/_serverSpecificVarsAfterInit.cfm
<cfset application.url.publiclogin = application.fapi.getLink(type="farLogin",view="displayPageStandard",bodyView="displayTypeBody") />
webskin/farLogin/displayPageStandard.cfm
<cfsetting enablecfoutputonly="true">

<cfimport taglib="/farcry/core/tags/webskin/" prefix="skin" />

<cfoutput>
<html>
	<body>
		<skin:view typename="#stobj.typename#" objectid="#stobj.objectid#" webskin="#url.bodyView#" />
	</body>
</html>
</cfoutput>

<cfsetting enablecfoutputonly="false">
webskin/farLogin/displayTypeBody.cfm
<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>
 
<ft:form>
	<ft:object typename="farLogin" lFields="username,password" prefix="login" legend="" focusField="username" />
	<ft:button value="Log In" />
</ft:form>

<cfsetting enablecfoutputonly="false">

http://discourse.farcrycore.org/t/separate-public-and-webtop-login-pages/354

Inline Login Pod

config/_serverSpecificRequestScope.cfm
<cfset stLocal.stResult = application.security.processLogin() />
webskin/dmProfile/displayUserInfo.cfm
<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">
webskin/types/displayHeaderStandard.cfm
...
<skin:view typename="dmProfile" webskin="displayUserInfo" />
...

Ajax Login Pod

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

config/_serverSpecificVarsAfterInit.cfm
<cfset application.url.publiclogin = application.url.webroot />
webskin/dmProfile/displayUserInfo.cfm
<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">
webskin/types/displayHeaderStandard.cfm
...
<skin:view typename="dmProfile" webskin="displayUserInfo" bAjax="true" ajaxURLParameters="returnURL=#urlencodedformat(application.fapi.fixURL())#" />
...