Oracle Apex - Creating own Login page
You need a custom authentication scheme to solve this, not conditional branching etc. You also do not need to build a new login page. The standard login page will hold all you need, and will simply use the current active authentication scheme. Authentication schemes can be found under the Shared Components.
You can find some oracle documentation here. There are also plenty of blog posts to be found when you search for "oracle apex custom authentication" on google!
Also, when creating a custom scheme, you can click the item labels for help. For example, this is in the authentication function name help:
Specify the name of the function that will verify the user's username and password, after they were entered on a login page. If you enter nothing, you allow any username/password to succeed. The function itself can be defined in the authentication's 'PL/SQL Code' textarea, within a package or as a stored function.
This function must return a boolean to the login procedure that calls it. It has 2 input parameters 'p_username' and 'p_password' that can be used to access the values an end user entered on the login page.
For example, enter the following code in the 'PL/SQL Code' textarea
function my_authentication ( p_username in varchar2, p_password in varchar2 ) return boolean is l_user my_users.user_name%type := upper(p_username); l_pwd my_users.password%type; l_id my_users.id%type; begin select id , password into l_id, l_pwd from my_users where user_name = l_user; return l_pwd = rawtohex(sys.dbms_crypto.hash ( sys.utl_raw.cast_to_raw(p_password||l_id||l_user), sys.dbms_crypto.hash_md5 )); exception when NO_DATA_FOUND then return false; end;
and
my_authentication
as 'Authentication Function'.
Note that your function requires parameters p_username and p_password!
You can leave the other fields blank, they will be handled by default functions!
Comments
-
Katherine almost 2 years
I created a new login page wherein only those account that can be found on the database could login to our home page... What i plan is when i click the login button, the user will be redirected to the home page.. I do this by creating a new branch and then in the conditions tab, i put the code for checking the existence of the account that has been inputted in the text field.. but what happened is it just show an error message 'invalid login credentials' always...
i'm sure that the code in conditions that we put is correct,,,, it could detect that the username and password is wrong because it shows the error message i created that returns when this happend...
here is the code in my conditions.. check_login is a procedure that returns true if the account is found in the database...
if CHECK_LOGIN(:P111_USERNAME, :P111_PASSWORD) then return true; else return false; end if;
could anyone help us with this one? Thanks in advance