6 Replies Latest reply: Apr 26, 2012 1:47 AM by Gurujothi RSS

    How to use the update password wizard in apex 4.1

    Gurujothi
      Dear All,
      I am using apex 4.1,
      In my application am using custom authentication scheme,
      There is one table called login_table , if the username exists with the password then they can login to the application,
      and also I have the link to change the password in Home_Page ,
      when the user clicks the link they will redirected to another page to change their password,
      In that page There are 4 fields,

      1.Username
      2.current_password
      3.New_password
      4.retype

      here my requirement is when the user comes to this page
      i.e change password page,
      By deafault the username column should hold the current logged in username and it cannot be edited.
      How can I get this?
      Please Help me.
      Thank you,
      Regards,
      Gurujothi
        • 1. Re: How to use the update password wizard in apex 4.1
          Paul Broughton
          Hi Gurujothi,

          I'm presuming that your users are logged in when they click the change password link, if so just make your Username field a read only field and in the Source Type choose: PL/SQL Expression or Function and then enter :APP_USER in the expression field. This will then use the username of the logged in User.

          Hope this helps.

          Thanks

          Paul
          • 2. Re: How to use the update password wizard in apex 4.1
            Gurujothi
            Hi Paul,
            Thank you for your reply and sorry if I explained wrongly,
            My users or not logging in when they clicking the change password,
            see the below function which I used in my Custom authentication scheme,

            create or replace function "CUSTOMAUTHENTICATION"
            (p_username in VARCHAR2,
            p_password in VARCHAR2)
            return BOOLEAN
            is
            begin
            FOR c1 IN (SELECT 1
            FROM login_table
            WHERE upper(username) = upper(p_username)
            AND upper(password) = upper(p_password))
            LOOP
            APEX_UTIL.SET_SESSION_STATE('FUSER',upper(p_username));
            RETURN TRUE;
            END LOOP;
            APEX_UTIL.SET_SESSION_STATE('FUSER');
            RETURN FALSE;

            end;


            So during the login time if the username exist in the table login_table with the appropriate password they can login to the home_page
            in the home_page only the change_password link is available and not in login page itself.
            How can I get this.
            Thank you,
            regards,
            gurujothi
            • 3. Re: How to use the update password wizard in apex 4.1
              Paul Broughton
              Hi Gurujothi,

              Unless I'm misunderstanding to change the password it uses the following flow.

              User Logs in => User is Directed to home Page after Login => User Presses Change Password Link => User is Directed to Change Password Page.

              If your users are logged into the application after successfully authenticating then you will be able to follow the Steps I outlined earlier.

              In the page that it directs you to after clicking the change password link make your Username field on that page is a read only field (This is not the Username field on your Login Page).

              Now in the Source Type choose: PL/SQL Expression or Function and then enter :APP_USER in the expression field. This will then populate the username field on your change password page with the user that is currently authenticated for the system.

              Sorry if my steps weren't clear originally.

              Thanks

              Paul
              • 4. Re: How to use the update password wizard in apex 4.1
                Gurujothi
                Hi Paul,
                Thank you so much its working Fine:-)
                Thank you,
                regards,
                gurujothi
                • 5. Re: How to use the update password wizard in apex 4.1
                  Gurujothi
                  Dear Paul,
                  I have some more question,
                  When they are typing the current_password I want to check whether they entered correct password for the username and
                  also have to check the New_password and Retype_password are same,
                  I tried by validate item but its not working fine.

                  Thank you,
                  Regards,
                  gurujothi
                  • 6. Re: How to use the update password wizard in apex 4.1
                    Gurujothi
                    Dear Paul,
                    I used the login_table for my login page,
                    which has only two fields username and password as like login screen, in my appliction in the change password page
                    I used the another table called Update_user
                    which has four fields,
                    1.username
                    2.current_password
                    3.New_password
                    4.Retye

                    and the change password page contains this exact same 4 fields from this Table,
                    whenever the users entering the 4 fields and if they click the create/update button the data will be stored in the Update_Table
                    and the password field in the Login_table will be updated based on the following trigger,
                       create or replace TRIGGER  trg1 
                    before insert on update_user 
                    referencing old as old new as new
                    for each row
                    begin
                        update login_table set password= :new.retype where username=:new.username;
                    end;
                           
                    As you said I tried that :APP_USER and I made the username column as read only,
                    When the values inserted except the username other 3 values inserted into the update_user table and the login_table not updated so the password also not changed,
                    Is there any other way to directly upadte the password in the Login_table without going for another Table?
                    Please Give some suggestion.
                    Thank you,

                    regards,
                    Gurujothi