In this blog, we will discuss how to implement Password Reset using Tokens in Oracle APEX, preview PDF files in Oracle APEX using JavaScript and PL/SQL and uploading bulk files. So, let’s begin.
1. Password Reset in Oracle APEX
To implement this feature in your application, you would need to create a Button to Reset Password in your Login page, and create a token that will be emailed to the User.
Steps involved:
Step 1: Create a Button named ‘Forgot Password’ in the login page of the application.
Step 2: Create a Page for Generating Reset password link.
2.1. Create a Page Item (text field) for User Email.
2.2. Create a Button: ‘Generate Link’, that will send the link to Reset the password, when clicked.
Step 3: In this page, create a PL/SQL Process that calls a Procedure to generate and store the token in a custom user table and Send an email notification to the user on-click of the Button.
Attachment – Generate Token process code
Table: to store user tokens
Attachment – Procedure Send Reset Password
Step 4: Create a ‘Reset Password’ Page with 2 text fields to capture the New Password and Confirm Password details.
Create the following 3 Validations:
4.1. Validation to ensure new password and confirm password match.
4.2. Validation criteria for password entry.
4.3. Validation to check if the password has expired by referring the valid_till column.
Step 5: Create a button to Reset password which will update Password details. Prior to this, create a Before Header Process to fetch the email of the user using the newly generated token and you are done!
Attachment – Process for Reset Password Page
Attachment – Procedure of SendResetPasswordConfirmation
Also Read – Oracle APEX Tips and Tricks – Part 2
2. Preview PDF files in Oracle APEX using JavaScript and PL/SQL
Here, we will Preview the uploaded pdf file in a page container by making simple preview link using PL/SQL and JavaScript.
Steps Required:
Step 1: Create a File Upload page item in a form and also a submit button to Upload.
Step 2: Create a Table for file upload that contains the following attribute:
- File ID, Mime Type, File Name and File Blob
- Create a Process of type Form – Automatic Row Processing (DML) to insert in the table on button click. Also, create one branch for passing this file id to the next page.
Step 3: Create an Application Item named as DOWNLOAD_FILE_ID and an Application Process
named as DOWNLOAD_FILE.
Attachment – Application_Process_download_file
Step 4: Create a Page to Display/Preview that pdf file a static content region.
4.1 Create a Dynamic action on Page load which will generate a Preview link and create an object URL for the file.
4.2 Create one static content region and assign a static id to it and also.
4.3 Create a Page Item to store the Preview link.
Attachment – Preview link Dynamic Action
Attachment – Load Video Dynamic Action
Image Preview:
3. How to Bulk Upload files in Oracle APEX
In this part, we will see how you can Upload multiple files using the File Upload page item and simple PL/SQL to insert data into your database table.
Steps Required:
Step 1: Create a Page Item of type: File Upload and a button to Upload files.
Step 2: Create a table with the following attributes to store the uploaded files.
Step 3: Create a not null Validation on the Page Item.
Step 4: Create a Process of type: Execute code to insert files into the database.
Attachment – Multiple File Upload Process
If you have any questions or concerns, please get in touch with us on [email protected].