Changing the Login and Start Pages
June 16th, 2008 | Oracle APEX
Sometimes the simplest things make the biggest difference. Some users want to see a summary screen when they access an application, others want to get straight to business. If we can reduce the number of clicks required to get users to their desired page then we have happy customers. So how can you tailor your APEX application so that users aren’t just taken to Page 1 when they log in? And what if you don’t want to have page 101 as your login page?
Changing the Start Page
If you take a look at the login page that’s been created for your application you’ll see there is a process on the page called login. The source for this process should be something like:
wwv_flow_custom_auth_std.login(
P_UNAME => :P2_USERNAME,
P_PASSWORD => :P2_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':1'
);
P_FLOW_PAGE determines the page the user is redirected to after logging in. You could easily change this to be hard-coded to a different page, a dynamically determined page or a page stored for each user in a table.
For example:
DECLARE
v_start_page number(10);
BEGIN
BEGIN
SELECT start_page
INTO v_start_page
FROM apex_users
WHERE upper(name) = upper(:P2_USERNAME);
EXCEPTION
WHEN no_data_found THEN
v_start_page := 1;
END;
wwv_flow_custom_auth_std.login(
P_UNAME => :P2_USERNAME,
P_PASSWORD => :P2_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':'||nvl(v_start_page,1)
);
END;
Changing the Login Page
To keep all of the pages relating to certain areas together, we’ve changed the page that users use to login. We wanted all of the generic pages that every user needed to access to be numbered below 100. A login page of 101 didn’t fit with this, so we copied login page 101 (it seemed the easiest option) and created a new page 2. In Shared Components > Authentication Schemes we selected Database Account, which is the option we are using. On this page, in the Page Session Management section, there is a Session Not Valid Page. We changed this value from 101 to 2. Now, when the session is not valid, APEX redirects to page 2 - our new login page. This allowed us to delete page 101, customise page 2 for our requirements and keep everything tidy.




















