bob32
bob32

Reputation: 515

Coldfulsion 7 (MX): Unable to read CF variables when bypass login

I'm trying to figure out simply if a user is logged in or not.

Once the user logs in, I can print the username via #GetAuthUser()#. The page I created (ex. IsLoggedIn.cfm) will prompt for a login, which is what I do not want. I want to check if they are logged in without prompting. If I add IsLoggedIn.cfm to application.cfm, I will no longer be prompted to log in, but the login check (cfif #GetAuthUser()# is not "") fails, I'm no longer able to read variables, I guess it's a scope issue.

Isn't there a way to just check if they're logged in without it prompting them to login? This seems so simple, yet I can't find an answer anywhere...

Any help would be greatly appreciated! Thanks in advance, Bob :)

Upvotes: 0

Views: 68

Answers (2)

bob32
bob32

Reputation: 515

Well, not that this makes any sense, but in the rare instance that this may help anyone else, I added the login bypass within the (cflogin) tags in the application.cfm file. now I'm able to access the variables i need.

Upvotes: 0

Adam Cameron
Adam Cameron

Reputation: 29870

There's no special trick to this.

In your log in code, just set session.isLoggedIn = true, and in your log out code, set it to false. Check that variable as appropriate.

Upvotes: 2

Related Questions