I have a blog that is password-protected. Each month I send out an e-mail newsletter that contains excerpts from articles in the blog. Each excerpt has a link to the blog so the user can read the whole story.
I am trying to link to the individual article in the blog from the e-mail. If the user is not logged in to the blog, I want them to go to the login page and then get directed to their requested blog article, not the blog home page.
Here is the code I use to determine if the user is logged in or not:
<!--- Check login status --->
<cfparam name="Session.Auth.isLoggedIn" default="No">
<cfif Session.Auth.isLoggedIn EQ "No">
<cfif ListLast(CGI.SCRIPT_NAME, "/") EQ "index.cfm">
<script>
self.location="/login.cfm";
</script>
</cfif>
</cfif>
How do I direct the visitor to the blog article after they login instead of just going to the blog home page? Do I have to add a URL parameter?
Here is a sample link:
http://www.myblog.com/blog/index.cfm/2012/3/13/this-is-the-blog-article
Here's a simple example...
Application.cfc...
Open in new window
logonAction.cfm...
Open in new window
logonForm.cfm...
Open in new window