Skip to main content
Known Participant
October 13, 2010
Answered

Add a USERTYPE to CF_Login

  • October 13, 2010
  • 2 replies
  • 634 views

How to add a new USERTYPE "POWER USER" to the following code:

<CF_Login

datasource="dev"

DBusername="dev"

DBpassword="zxy1997"

TABLE=users

USERFIELD=User_Email

PASSFIELD=Password

SELECTFIELDS="User_ID"

USERTYPEFIELD=User_Type

USERTYPE="MANAGER"

MESSAGE="<H1>Authorization Required</H1> This server could not verify that you are authorized to access the info requested.<P>">

This topic has been closed for replies.
Correct answer BKBK

1) In the custom tag page Login.cfm, place this line somewhere at the top:

<cfset caller.loginStatus = "bad">

Then, right after the custom tag's login code, do something like this pseudocode:

(Check if login succeeded. If it did, then)

    <cfset caller.loginStatus = "good">

(Endif)

2) In the calling page, do something like this

<CF_Login datasource="dev" ... etc. ... USERTYPE="MANAGER" ...>

<cfif loginStatus is "bad">
    <CF_Login datasource="dev" ... etc. ... USERTYPE="POWER_USER" ...>
</cfif>

2 replies

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
October 13, 2010

1) In the custom tag page Login.cfm, place this line somewhere at the top:

<cfset caller.loginStatus = "bad">

Then, right after the custom tag's login code, do something like this pseudocode:

(Check if login succeeded. If it did, then)

    <cfset caller.loginStatus = "good">

(Endif)

2) In the calling page, do something like this

<CF_Login datasource="dev" ... etc. ... USERTYPE="MANAGER" ...>

<cfif loginStatus is "bad">
    <CF_Login datasource="dev" ... etc. ... USERTYPE="POWER_USER" ...>
</cfif>
Community Expert
October 13, 2010

This is a custom tag, so you'd have to edit the file Login.cfm and change its functionality as desired.

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

GSA Schedule, and provides the highest caliber vendor-authorized

instruction at our training centers, online, or onsite.

Dave Watts, Eidolon LLC
albertkaoAuthor
Known Participant
October 13, 2010

I like to clarify my question.

If the following code fail to login for USERTYPE="MANAGER",

then I like to try to login with USERTYPE="POWER USER",

     if login ok, then continue,

     else display error message.

<CF_Login

   datasource="dev"

   DBusername="dev"

   DBpassword="zxy1997"

   TABLE=users

   USERFIELD=User_Email

   PASSFIELD=Password

   SELECTFIELDS="User_ID"

   USERTYPEFIELD=User_Type

   USERTYPE="MANAGER"

   MESSAGE="<H1>Authorization Required</H1> This server could not verify that you are authorized to access the info requested.<P>">

Community Expert
October 13, 2010

The CF_LOGIN tag isn't something built into CF. So, I can't really tell you how to use or modify it. But you should be able to modify it yourself. You could modify it to accept a list of usertypes, and try them sequentially. Or, you could use it, then see if the user is logged in, and if not, use it again with a different usertype value.

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

GSA Schedule, and provides the highest caliber vendor-authorized

instruction at our training centers, online, or onsite.

Dave Watts, Eidolon LLC