Skip to main content
Known Participant
October 30, 2019
Answered

How to Redirect users to a password change page when Username is expired.

  • October 30, 2019
  • 2 replies
  • 2530 views

Hi All,

   We are using ColdFusion 2018 and a Oracle 11G Database. I am trying to redirect users to a change password page when the username is expired.   Users are database users who access the ColdFusion front-end. As of now we get an error message as shown below.  Upon clicking login(submit button) , users go to the authenticate.cfm page which displays the error messsage shown below, instead of this I would like them to another page within the application called changepassword.cfm (I already have this page). What is the easisest way to do this redirection ?   Thanks for your help.

IQ

 

"Error Occurred While Processing Request. Please try again.

Error Executing Database Query. [Macromedia][Oracle JDBC Driver][Oracle]ORA-28001: the password has expired  The error occurred on line 28."
 
 
    This topic has been closed for replies.
    Correct answer BKBK

    Hi bkbk,

      Thanks for your help, we have decided to use LDAP for authentication, so basically since the previous approach was not working, we would like to do the authentication suing LDAP instead of using Oracle usernames. Will this be possible , if yes then how can we do it , please advice ?

     

    Thanks

    IQ


    Hi iq11, yes LDAP is possible. We in fact use it. But that is a new question.

     

    Please close this thread as answered, and start a new thread with your LDAP question. In so doing, you will help others who come to the forum looking for a solution. 

    2 replies

    iq11Author
    Known Participant
    November 13, 2019

    Thanks bkbk, I think I could make some progress. But now I get the following error

     

    Error Executing Database Query.
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-28001: the password has expired
     
    The error occurred in C:/inetpub/wwwroot/eAPS/ChangePasswordAction.cfm: line 18
    16 :  <cfelse>
    17 : 	<cfquery name="changepassword" datasource="#datasource#" Username="#Form.login#" password="#Form.Password#">
    18 : 	ALTER USER <cfqueryparam cfsqltype="VARCHAR"  value="#FORM.LOGIN#"> IDENTIFIED BY <cfqueryparam cfsqltype="VARCHAR"  value="#LCase(FORM.VERIFYPASSWORD)#">
    19 : 	</cfquery>
    20 : 	<script>
     
     
    Resources:
    BKBK
    Community Expert
    Community Expert
    November 13, 2019

    There is no ColdFusion error, so we're on to a good start. Check out the suggestions in https://stackoverflow.com/questions/40581131/ora-28001-the-password-has-expired

     

    iq11Author
    Known Participant
    November 14, 2019

    Hi bkbk,

      Thanks for your help, we have decided to use LDAP for authentication, so basically since the previous approach was not working, we would like to do the authentication suing LDAP instead of using Oracle usernames. Will this be possible , if yes then how can we do it , please advice ?

     

    Thanks

    IQ

    BKBK
    Community Expert
    Community Expert
    October 31, 2019

    To be sure I understand correctly, you wish to redirect users to a password change page when their database password expires. If so, then you could do something like

     

     

    <!--- authenticate.cfm --->
    <cfscript>
    try {
     /* Authentication code involving database query */
    } catch (database dbException) {
          /* Enable this, in the test phase at the beginning, to see what dbException.detail looks like when the exception occurs! (I have assumed that dbException.detail contains the phrase 'password has expired')*/
         /*writedump(dbException);*/
        if (dbException.detail contains "password has expired") {
            location (url="http://...etc./changePassword.cfm");
        }
    	
    }
    </cfscript>

     

     

     

    iq11Author
    Known Participant
    October 31, 2019

    Thanks BKBK, your help is much appreciated, this exactly what I am looking for.

      I tried modificying the authenticate.cfm file  as shown in the code below , the <cfscript> beginning tag is having a closing tag </cfscript> tag but I get an error which states

    "The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfscript>. If the body of the tag is empty, you can use the shortcut <cfscript .../>. The CFML compiler was processing: A cfscript tag beginning on line 106, column 2. A cfscript tag beginning on line 106, column 2."

     

     

    -- Code used in authenticate.cfm is given below


    <CFLOGINUSER name="#Session.UserName#" password="#Session.Password#" roles="">

    <cfif dbtype is 'oracle'>
    <cfscript>
    try {
    <cfquery name="LookUp" datasource="#datasource#" username=#Form.UserName# password=#Form.password#>
    SELECT max(ipn) FROM dbo.look_up
    </cfquery>
    }
    catch (database dbException) {
    /* Enable this, in the test phase at the beginning, to see what dbException.detail looks like when the exception occurs! (I have assumed that dbException.detail contains the phrase 'password has expired')*/
    /*writedump(dbException);*/
    if (dbException.detail contains "password has expired") {
    location (url="http://atfw01/aPS/changePassword.cfm");
    }
    }
    </cfscript>

    iq11Author
    Known Participant
    November 12, 2019

    What is the name of the page you've shown here?

    What is the action of the form?

    What do you want to happen between the form page and the page you've shown here?


    The name of the page shown here changepasswordaction.cfm this is the action program which should be called when the previous page changepassword.cfm is used to click the submit button and it should get redirected to the homepage which is the login page but this does not happen and the user continues to be at the same page changepassword.cfm

    What could be done to fix this ?

     

     

    If I use <cftry> <cfactach> I see the following error code

     

    • Message: Error Executing Database Query.
    • Native error code: 28001
    • SQLState: HY000
    • Detail: [Macromedia][Oracle JDBC Driver][Oracle]ORA-28001: the password has expired