Created
June 24, 2009 10:48
-
-
Save virtix/135150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!------------------------------------------------------------------------- | |
Assume a login form with username and pasword: | |
form.user_id and form.password | |
--------------------------------------------------------------------------> | |
<cfquery name="loginQuery" datasource="users" maxrows="1"> | |
SELECT password_hash, salt | |
FROM USERS where user_id = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.user_id#" maxlength="12" /> | |
</cfquery> | |
<cfset hashedFormPassword = crypto.computeHash(form.password, loginQuery.salt) /> | |
<cfif loginQuery.password_hash eq hashedFormPassword> | |
Valid user. | |
<cfelse> | |
Invalid user. | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment