Skip to content

Instantly share code, notes, and snippets.

@ronnieduke
Forked from stevewithington/dsp_sharedLogin.cfm
Created February 16, 2014 22:57
Show Gist options
  • Save ronnieduke/9041840 to your computer and use it in GitHub Desktop.
Save ronnieduke/9041840 to your computer and use it in GitHub Desktop.
<!--- drop this file under the theme's display_objects directory --->
<cfoutput>
<form id="login" class="form-horizontal" name="frmLogin" method="post" action="?nocache=1" onsubmit="return validate(this);" novalidate="novalidate" >
<legend>#arguments.$.rbKey('user.pleaselogin')#</legend>
<div class="control-group">
<label class="control-label required" for="txtPassword">#arguments.$.rbKey('user.password')#</label>
<div class="controls">
<input type="password" id="txtPassword" name="password" placeholder="#arguments.$.rbKey('user.password')#" required="true" message="#htmlEditFormat(arguments.$.rbKey('user.passwordrequired'))#" />
<span class="help-inline">#htmlEditFormat($.rbKey('user.required'))#</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<!--- You'll see that I'm simply using a HIDDEN form field to hold the name of the shared user (e.g., "shareduser"). --->
<input type="hidden" id="txtUsername" value="shareduser" name="username" />
<input type="hidden" name="doaction" value="login" />
<input type="hidden" name="linkServID" value="#HTMLEditFormat(arguments.$.event('linkServID'))#" />
<input type="hidden" name="returnURL" value="#HTMLEditFormat(arguments.$.event('returnURL'))#" />
<button type="submit" class="btn btn-primary">#htmlEditFormat(arguments.$.rbKey('user.login'))#</button>
</div>
</div>
</form>
</cfoutput>
<cfcomponent extends="mura.cfobject" output="false">
<!--- drop this method into your theme's eventHandler.cfc --->
<cffunction name="onSiteLoginPromptRender">
<cfargument name="$">
<cfset var str = "">
<!--- change the filename to the page/section's actual filename (instead of 'shared-content-protected') --->
<cfif arguments.$.content('filename') eq 'shared-content-protected'>
<cfsavecontent variable="str">
<cfinclude template="display_objects/dsp_sharedLogin.cfm">
</cfsavecontent>
</cfif>
<cfreturn str>
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment