Hello all,
This is my problem. When a user logs in, copies the URL after logging in (to any of the pages), then logs out and pastes the URL, they can go back to that page. However, if they close the browser, then paste that URL, it sends them straight to the userlogin form.
How can I get the user to not be able to view the pages after they logout and keep the browser open?
This is my application.cfm page:
This is my logout.cfm page:
Note: I know that the code in the logout.cfm page seems repetitive but I wanted to show you what I've already tried.
Here is my loginchecker.cfm page:
Thanks for any input!
This is my problem. When a user logs in, copies the URL after logging in (to any of the pages), then logs out and pastes the URL, they can go back to that page. However, if they close the browser, then paste that URL, it sends them straight to the userlogin form.
How can I get the user to not be able to view the pages after they logout and keep the browser open?
This is my application.cfm page:
Code:
<cfapplication sessionmanagement="Yes">
<cfif CGI.SCRIPT_NAME IS "/MCSD/index.cfm"><cflocation url="/MCSD/Login/UserLoginForm.cfm" addtoken="no"></cfif>
<cfif not isdefined("session.auth.isloggedin")>
<cfif isdefined("form.username")>
<cfinclude template="Login/loginchecker.cfm">
</cfif>
<cfinclude template="Login/UserLoginForm.cfm">
<cfabort>
<cfelse>
</cfif>
This is my logout.cfm page:
Code:
<CFSET Session.Auth.isLoggedIn = "No">
<cfset session.auth.UserName = "">
<cfset session.auth.Password = "">
<CFSCRIPT>StructClear(Session.Auth);</CFSCRIPT>
<cfset StructDelete(session.auth, "isloggedin")>
<cfset StructDelete(session.auth, "UserName")>
<cfset StructDelete(session.auth, "Password")>
<cflocation url="../Login/UserLoginForm.cfm" addtoken="no">
Note: I know that the code in the logout.cfm page seems repetitive but I wanted to show you what I've already tried.
Here is my loginchecker.cfm page:
Code:
<cfquery name="loginCheck" datasource="MCSD">
SELECT ghrlast, ghrssn
FROM Employees_New
WHERE ghrlast = '#FORM.userName#'
AND ghrssn = '#FORM.Password#'
</cfquery>
<cfif #loginCheck.RecordCount# IS 0>
<cflocation url = "UserLoginForm.cfm">
<cfabort>
<cfelse>
<CFSET Session.Auth = StructNew()>
<CFSET Session.Auth.isLoggedIn = "Yes">
<CFSET Session.Auth.username = loginCheck.ghrlast>
<CFSET Session.Auth.password = loginCheck.ghrssn>
<cfset Session.Auth.ID = #FORM.Password#>
<CFIF #CGI.SCRIPT_NAME# IS "/MCSD/Login/UserLoginForm.cfm">
<cflocation url="../employee/index.cfm" addtoken="no">
<CFELSE>
<cflocation url = "#CGI.SCRIPT_NAME#" addtoken="no">
</cfif>
</cfif>
Thanks for any input!