Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The last step to creating an authentication system for a ColdFusion application is to give the user a way of logging out. Typically you do this by creating a hyperlink that's available on all pages. In ColdFusion, you log out from the ColdFusion Authentication Architecture by calling a tag called cflogout. This is a very simple tag, which takes no attributes. To implement this, I'll create a brand new page in the Login folder of my application. I'll go to that folder in the Navigator view, right-click and choose New > ColdFusion Page.
I'll name the page logout.cfm. This is another back-end page that the user will never see. I'm going to delete all of the default code and replace it with the tag cflogout. After logging the user out, I'm then going to send them back to the Application homepage with this code, cflocation url="../home/index.cfm". So after logging them out, I'll send them back to the homepage, but because they aren't logged in, they'll once again see the login form.
I'll save that change. I'm done with the page. I'll go to my Includes folder and open the header custom tag. In the navbar section, I'll add a new hyperlink. I'll place the cursor after the link to the Photos folder and put in a spacebar and a separator or a pipe character. Then on the next line, I'll create an anchor tag and I'll set the href attribute to point to ../login/logout.cfm.
That's the page I just created, which executes the cflogout tag and then sends the user to the homepage. Between the anchor tags, I'll display the text Log Out. I'll save the change to that file and now I'll test the entire system. I'll go back to the Navigator view and reopen my homepage, index.cfm, in the home directory. I'll run the page this time in an external browser. I'll log in, typing in the user name of joe and the password of smith.
After logging in, I now have access to the entire site for as long as I keep the browser open. But when I click the logout link, which is now displayed on every page, I'm returned back to the login form where I can type in my user name and password again, or simply close the browser. So those were the three tags that we use to create the authentication architecture: cflogin to execute code for non- authenticated users, cfloginuser to actually log the user in and register them with the ColdFusion security system, and cflogout to disrupt the connection between their browser and the server, and force them to login again the next time they visit the site.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101837 Viewers
61 Video lessons · 88587 Viewers
71 Video lessons · 72405 Viewers
56 Video lessons · 104101 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.