6 Replies Latest reply on Jul 10, 2006 8:21 AM by Yasmin_lady

    Cookies deletion is not working

    Yasmin_lady
      I use a cookie to save the password of a user so that the login goes automatically, without the needing the user to put in the password. but when a user changes his password the system is still taking the old pass word from the cookie. I tried to delete the Cookie usin the following piece of code with no success.

      <cfcookie name="Pass" value="0" expires="now">
      <cfcookie name="Username" value="0" expires="now">

      Can you tell me what am i doing wrong
      Many thanks
        • 1. Re: Cookies deletion is not working
          Kevin Schmidt Level 1
          What version of CF are you using? Can you post the code for the entire page that is doing the delete?
          • 2. Re: Cookies deletion is not working
            Yasmin_lady Level 1
            i am using coldfusion MX 6.1
            • 3. Re: Cookies deletion is not working
              Kevin Schmidt Level 1
              Can you post the code?
              • 4. Re: Cookies deletion is not working
                Yasmin_lady Level 1
                i am using coldfusion MX 6.1
                • 5. Re: Cookies deletion is not working
                  Kevin Schmidt Level 1
                  Can you post all of your ColdFusion (CFML) code that you are using to try to delete the cookies?
                  • 6. Re: Cookies deletion is not working
                    Yasmin_lady Level 1
                    <cfcase value="update">
                    <cfif isDefined("name") and isDefined("username") and isdefined("email")>
                    <!--- Benutzername schon vergeben ? --->
                    <cfquery name="RSuserX" datasource="#A_DSN#">
                    SELECT lfdNr FROM Benutzerdaten
                    WHERE Benutzername = '#username#'
                    AND lfdNr <> #S_id#
                    </cfquery>
                    <cfif RSuserX.recordCount is 0>
                    <!--- gültiger Benutzername --->
                    <!--- altes Paßwort --->
                    <cfquery name="RSuserX" datasource="#A_DSN#">
                    SELECT Passwort FROM Benutzerdaten
                    WHERE lfdNr = #S_id#
                    </cfquery>
                    <cfset pw = false>
                    <!--- überprüfen,ob altes Paßwort richtig ? --->
                    <cfif not passwordOld is ''>
                    <cfoutput query="RSuserX">
                    <cfmodule template="usertags/crypt.cfm" password="#Passwort#" key="#passwordOld#" mode="decrypt">
                    <!---<cfif decrypt(Passwort,passwordOld) is passwordOld>--->
                    <cfif cryptPw is passwordOld>
                    <cfset pw = true>
                    <cfelse>
                    <cfset mess="Das angegebene alte Passwort ist ungueltig!">
                    <cflocation addtoken="no" url="update.cfm?id=#id#&message=#mess#">
                    </cfif>
                    </cfoutput>
                    </cfif>
                    <!--- Benutzerdaten ändern --->
                    <cfif pw>
                    <cfmodule template="usertags/crypt.cfm" password="#password#">
                    <cfquery name="RSuser" datasource="#A_DSN#">
                    UPDATE Benutzerdaten
                    SET Benutzername='#username#',
                    Name = '#name#',
                    Vorname = '#vorname#',
                    email = '#email#',
                    Passwort = '#cryptPw#'

                    WHERE lfdNr = #S_id#
                    </cfquery>
                    </cfif>
                    <cfset session.admin = username>
                    <cfset session.name = vorname & " " & name>
                    <!--- <cfset Session.update ="true"> --->
                    <cfcookie name="Pass" value="0" expires="now">
                    <cfcookie name="Username" value="0" expires="now">

                    <cfset mess="Benutzerdaten erfolgreich geaendert!">
                    <script language="JavaScript" type="text/javascript">
                    alert ('<cfoutput>#mess#</cfoutput>');
                    </script>
                    <cflocation addtoken="no" url="update.cfm?id=#id#">
                    <cfelse>
                    <cfset mess="Benutzername existiert bereits!">
                    <cflocation addtoken="no" url="update.cfm?id=#id#&message=#mess#">
                    </cfif>
                    </cfif>
                    </cfcase>
                    <cfcase value="remove">
                    </cfcase>