Business case: How can the end user change his password?
(in reply to Dennis question in the APEX forum)
Prerequisite: APEX_AUTHENTICATION (default) = APEX_USER created in the workspace
The documention is straight forward:
The procedure example code is:
BEGIN APEX_UTIL.CHANGE_CURRENT_USER_PW ('secret99'); END;Step by step:
1. create a new page - type "blank" - let's say: Page 9
2. create a region named: Password change region
3. create an item named: P9_NEW_PWD of type "text field"
4. create a button named: "change Password"
5. in Page Processing - Processing - create a procedure named "change_password" of type pl/sql
6. in "PL/SQL Code" enter the above PL/SQL code
7. replace 'secret99' by :P9_NEW_PWD so it looks:
BEGIN APEX_UTIL.CHANGE_CURRENT_USER_PW (:P9_NEW_PWD); END;8. and last steps:
- the PL/SQL procedure "change_password" selected
- right hand in region "Success message" enter in: "Password changed successfully (:-)"
- in region "error message" key in "nothing done - error"
- in region "Server side condition" and "When Button pressed" select: "change Password"
SAVE everything - Test
What does the procedure do?
It just uses your username (:APP_USER or &APP_USER. ) and replaces the corresponding password with the new Password.
I hope that helps.
BTW: there es another procedure to change the password:
There, the user must key in his present password and can enter a new password.
The example code of the procedure:
apex_util.reset_password ( p_old_password => :P111_OLD_PASSWORD, p_new_password => :P111_NEW_PASSWORD );