Skip to content

Instantly share code, notes, and snippets.

@jsieber
Created February 19, 2015 20:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsieber/014827cf4dc64d637593 to your computer and use it in GitHub Desktop.
Save jsieber/014827cf4dc64d637593 to your computer and use it in GitHub Desktop.
custom returnLoginCheck
<cfif variables.$.event('expired') eq true>
<div class="alert alert-error">#variables.$.rbKey('user.forgotexpired')#</div>
</cfif>
user.forgotexpired=The temporary login link that you requested has expired. Please request a new link below.
<cffunction name="returnLoginCheckCustom" output="false">
<cfargument name="$">
<cfset var rs="">
<cfif not arguments.$.currentUser().isLoggedIn() and len(arguments.$.event('returnID')) and len(arguments.$.event('returnUserID'))>
<cfquery name="rs" datasource="#variables.configBean.getReadOnlyDatasource()#" username="#variables.configBean.getReadOnlyDbUsername()#" password="#variables.configBean.getReadOnlyDbPassword()#">
select created from tredirects
where redirectID=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.$.event('returnID')#" >
</cfquery>
<cfif rs.recordcount and rs.created gte dateAdd("d",-2,now())>
<cfset loginByUserID($.event('returnUserID'),arguments.$.event('siteID'))>
<cfset structDelete(session,"siteArray")>
<cfelse>
<cflocation url="?display=login&expired=true##reminder" addtoken="false">
</cfif>
</cfif>
</cffunction>
<cffunction name="onApplicationLoad" output="no" returntype="void">
<cfargument name="event">
<cfset $.getBean("userUtility").injectMethod("returnLoginCheck",returnLoginCheckcustom) />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment