Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Created February 14, 2014 16:24
Show Gist options
  • Save stevewithington/9004144 to your computer and use it in GitHub Desktop.
Save stevewithington/9004144 to your computer and use it in GitHub Desktop.
Mura CMS: How to lock down a page/section with a single, shared password. 1) Create a User Group called "Shared User Group" 2) Create a User called "Shared User" and assign that user to the "Shared User Group" ... you could use something like "shareduser" for the username ... just be sure to note the password! 3) Lock down the content node you w…
<!--- 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