This tutorial will show you how to check your users that are logging in to your application for Case SenSitIVe passwords.

The first thing you need is the form that asks your users to log in, we'll call this page "login.cfm":

	<form action="login_process.cfm" method="post">
    	Username: <input type="text" name="user_name" value="" /><BR />
  		Password: <input type="password" name="pass_word" value="" /><BR />
        <input type="submit" name="login_user" value="Log In" /><BR />
    </form>

Now create the page that will log the user is, we'll call this page "login_process.cfm".

	<cfquery name="qVerify" datasource="YourDSN">
    	SELECT ID, username, password
        FROM Members
        WHERE password = '#pass_word#'
        	AND username = '#user_name#'
	</cfquery>
    
    <!--- ok now check for the case sensative --->
    <cfset comparison = Compare(FORM.pass_word, qVerify.password) />
    
    <!--- see what to do --->
    <cfif comparison eq 0>
    	<!---  User is good, log in and redirect --->
	<cfelse>
    	<!--- user did not supply a valid CAsE sensative password, alert and ask to login again! --->
    </cfif>

Ok, the location that actually checks for the CaseSenSitive format is the line:

	<!--- ok now check for the case sensative --->
    <cfset comparison = Compare(FORM.pass_word, qVerify.password) />

The command "comparison" is cAsE seNSatiVe in nature, for more information about this command, please click here.

That's it, you can now implement another layer of security by ensuring that your users are using their information correctly..

Questions? Comments? Email me...

About This Tutorial
Author: Pablo Varando
Skill Level: Beginner 
 
 
 
Platforms Tested: CF5,CFMX
Total Views: 165,242
Submission Date: February 05, 2003
Last Update Date: August 25, 2011
All Tutorials By This Autor: 47
Discuss This Tutorial
  • I always store the password in the database using the coldfusion function hash(). then to compare the logon form password to the database, cfif hash(form.password) EQ query.password this way the passwords are safe, even from moderators, other admins, a hacked database, etc, they can contain special characters, and are naturally case sensetive.

Advertisement


Website Designed and Developed by Pablo Varando.