+ All Categories
Home > Documents > User Self-Registration in Oracle APEX Using the ... · called in APEX o API calls like...

User Self-Registration in Oracle APEX Using the ... · called in APEX o API calls like...

Date post: 17-Apr-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
28
User Self-Registration in Oracle APEX Using the Application Express Accounts Authentication Scheme Load Attached Code ....................................................................................................................2-3 Create New Application in APEX..................................................................................................4-5 Create the Registration Page .....................................................................................................6-21 Configure the Login Page.........................................................................................................22-25 Test Registration Function.......................................................................................................26-27 References .................................................................................................................................... 28 Disclaimer: We do not take responsibility for any unintended or unwanted consequences in your instance of Oracle, Oracle APEX, or related products as a result of reading our blogs or following our guides. Though the information is fully tested and generally safe to use, our lawyers really have a thing against admitting potential wrongdoing. If it makes you feel any better, I occasionally turn the brightness down on their monitors to make them think it is broken. When they order a new one, I take the old one, restore the brightness settings, and donate it to a school.
Transcript

User Self-Registration in Oracle APEX Using the Application Express Accounts Authentication Scheme

Load Attached Code .................................................................................................................... 2-3

Create New Application in APEX .................................................................................................. 4-5

Create the Registration Page ..................................................................................................... 6-21

Configure the Login Page ......................................................................................................... 22-25

Test Registration Function ....................................................................................................... 26-27

References .................................................................................................................................... 28

Disclaimer: We do not take responsibility for any unintended or unwanted consequences in your instance of Oracle, Oracle APEX, or related products as a result of reading our blogs or following our guides. Though the information is fully tested and generally safe to use, our lawyers really have a thing against admitting potential wrongdoing. If it makes you feel any better, I occasionally turn the brightness down on their monitors to make them think it is broken. When they order a new one, I take the old one, restore the brightness settings, and donate it to a school.

2

Load Attached Code

1. Login to your APEX workspace 2. Go to SQL Workshop and then to SQL Commands 3. Open up the Traust APEX Blog Self-Registration Example.sql file 4. Read through the Description sections for the 8 items in the file and change the schema

and email address references to match your own 5. Copy/Paste and run the following in SQL Workshop:

• CREATE SEQUENCE EXAMPLE_USER_SEQ • CREATE TABLE PENDING EXAMPLE USER QUEUE • INSERT PENDING EXAMPLE USER INFO RECORD • CREATE USER GROUP FOR EXAMPLE USERS • GENERATE TEMPORARY PASSWORD • CREATE A NEW EXAMPLE USER

3

6. Open up Toad, SQL Developer, or whatever you use to login as sys or sysdba • The scheduled job must be created this way in order to execute when being

called in APEX o API calls like apex_util.create_user cannot be executed by a public user

even if it is being called behind the scenes in a pl/sql page process o By calling that same pl/sql block from a scheduled job created as sys or

sysdba, you can execute it successfully behind the scenes without having to do anything dangerous like granting extra privileges to APEX_PUBLIC_USER

7. Copy/Paste and run the following:

• DBMS_SCHEDULER JOB FOR CREATE A NEW EXAMPLE USER

4

Create A New Application in APEX

1. Click on App Builder 2. Click on Create

3. Select New Application

5

4. Name your application and use the default settings with only the Home Page

6

Create the Registration Page

1. After the application is created, click on the Create Page button 2. Select Blank Page and click the Next button

7

3. Match your inputs to the picture below for the blank page information and click the Next button

8

4. Click do not associate this page with a navigation menu entry

9

5. Finalize the page creation and click finish

10

6. Make the newly created New User Registration Page a public page

7. Click on the New User Registration Region and then click on Template options under Appearance

8. Change the accent to Accent 15

11

9. Right click on the New User Registration region and click on Create Page Item

10. Keep the page item as a text field 11. Name the field: User Name

12

12. Change the template for User Name to required

13. Keep the source information as the default

13

14. Right click on the User Name page item and click Duplicate 15. Duplicate the User Name page item until you have 4 User Name text fields

16. Change the names and labels of the duplicated items to: • FIRST_NAME • LAST_NAME • EMAIL_ADDRESS

14

17. Right Click on the New User Registration region and click on the Create Button

15

18. Match the Identification, Layout, and Appearance information to the picture below to make a Cancel button

19. Change the Behavior settings so the button does not execute validations

16

20. Right click on the Cancel button and click Duplicate

17

21. Match the Identification, Layout, and Appearance information to the picture below to make a Create New User button

22. Change the Behavior settings so the button does execute validations

18

23. Create a page PL/SQL page process

19

24. Name the process Add Code to Queue Table and Enter the follow code into the PL/SQL code box (remember to rename traustblog to the name of your schema):

BEGIN if :p1000_user_name is not null then traustblog.insert_pend_example_user (example_user_seq.nextval, :p1000_user_name, :p1000_first_name, :p1000_last_name, :p1000_email_address); end if; END;

20

25. Create a button server-side condition so it only fires when the Create_New_User button is pressed

26. Right click on the Add Code to Queue Table and click Duplicate 27. Rename the duplicated PL/SQL process to Run Schedule Job To Create User 28. Change the PL/SQL code to the following:

BEGIN dbms_scheduler.run_job(job_name => 'CREATE_EXAMPLE_USER_FROM_QUEUE_JOB', use_current_session => FALSE); END;

21

29. Add a Success Message and Error Message

30. Create a page branch and have it branch to the Login Page. Make sure you clear the cache for the Login Page

22

Configure the Login Page

1. Navigate to the Login Page 2. Right click on the Items heading within the Content Body 3. Click on Create Button

23

4. Match the Identification, Layout, and Appearance information to the picture below to make a Register button

5. Click on the Template Options to change the Type and set the Spacing Bottom to Large

24

6. Change the Register button Behavior so that it redirects to another page. Make sure you clear the cache for the Registration Page

25

26

Test Registration Function

1. Time to give everything a test. Run the application from the Login Page and click on the Register button

2. On the New User Registration page, enter some sample user data and click on the Create New User button

3. You should be taken back to the Login Page and the Success Message you defined should be at the top of the screen

27

4. To verify that everything worked properly, check the email address you entered for the

system generated email that contains your username and temporary password 5. In the meantime, click on the Icon in the upper right corner that looks like a user and a

wrench

6. Click on Manage Users and Groups

7. Check to see if your new user is now in your users list

8. Click on the link for your new user

28

References A big thank you to the members of the Oracle APEX Forum for providing various solutions to the issue of self-registration. I apologize if I missed citing any other forum topics, but if you mention them to me, I will certainly add them to the list. I do not take personal credit for anything mentioned in this guide since everything here was assembled from various pieces of public information and code snippets from the APEX forums. What little customizations I did, was in the interest of cleaning up the code and expanding the comments for clarity.

• https://community.oracle.com/message/14533128#14533128 • https://community.oracle.com/message/13017524#13017524 • https://community.oracle.com/message/13570160#13570160 • https://community.oracle.com/message/4392181#4392181 • https://community.oracle.com/thread/3956804


Recommended