iis - My Application.cfc logs me off when I click a link after initial login has any seen this error? -
my website using iis , coldfusion. reason when log site, click link or button cfm page located in same secure directory send me login. if login again not prompt me again session.
i have read on other post may have fact default page in iis index.cfm , when entering secure directory without defining page sent index. strange think alright.
my default page when entering admin directory index. included below application coldfusion component.
has had problem occur?
<cfcomponent> <cfset this.name = "admin"> <cfset this.sessionmanagement="true"> <cfset this.loginstorage="session"> <cffunction name="onrequeststart"> <cfargument name = "request" required="true"/> <cfif isdefined("form.logout")> <cflogout> </cfif> <cflogin> <cfif not isdefined("cflogin")> <cfinclude template="loginform.cfm"> <cfabort> <cfelse> <cfif cflogin.name "" or cflogin.password ""> <!---alert no password passed---> <script type="text/javascript"> window.settimeout(function() { $("#alert_message").fadeto(500, 0).slideup(500, function(){ $(this).remove(); }); }, 2000); </script> <!--- alert div---> <div id="alert_message" class="alert alert-danger fade in" role="alert" style="z-index: 100; position: absolute; top: 200px; left: 500px; width:600px"> <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">close</span></button> <h4 align="center">you must enter text in both user name , password fields.</h4> </div> </cfoutput> <!---my login page---> <cfinclude template="loginform.cfm"> <cfabort> <cfelse> <!---encryption key---> <cfset passwordkey ="my encryption key"> <cfset encrypted = encrypt(cflogin.password, passwordkey)> <cfquery name="loginquery" datasource="database_stuff"> select user_id, email, roles logininfo email = '#cflogin.name#' , password = '#encrypted#' </cfquery> <cfif loginquery.roles neq ""> <cfloginuser name="#cflogin.name#" password = "#encrypted#" roles="#loginquery.roles#"> <cfelse> <cfoutput> <!---alert if bad password passed---> <script type="text/javascript"> window.settimeout(function() { $("##alert_message").fadeto(500, 0).slideup(500, function(){ $(this).remove(); }); }, 2000); </script> <!--- alert div---> <div id="alert_message" class="alert alert-danger fade in" role="alert" style="z-index: 100; position: absolute; top: 200px; left: 500px; width:600px"> <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">close</span></button> <h4 align="center">i'm sorry bad password. please try again.</h4> </div> </cfoutput> <cfinclude template="loginform.cfm"> <cfabort> </cfif> </cfif> </cfif> </cflogin> <!--- if login adds logout button page---> <cfif getauthuser() neq ""> <cfoutput> <div style="position:fixed;z-index:1031;top:3px;left:55%;"> <form action="index.cfm" method="post"> <button type="submit" class="btn btn-warning" name="logout">logout</button> </form> </div> </cfif> </cffunction> </cfcomponent>
Comments
Post a Comment