Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

force user to login before loading target page

Gor_MahiaJul 14 2024

Hi,
iam having some issue with page access:
I've part of the below code which creates a link for each record and the block body is sent as part of the email which when users clicks will direct them to login page and load the detail page after successful login. It should not directly load the detail page unless a user successfully logs in but the problem I've is that email record links directly load the target page without prompting users to login first.
-----------------------------

declare
l_tabular_data VARCHAR2(32767 CHAR);
l_cnt number :=0;
begin
-- add table header
l_tabular_data := l_tabular_data || '<table style="font-family: arial, sans-serif; border-collapse: collapse; width: 100%;">'
|| '<tr>'
|| '<th style="background-color: #eeeeff; border: 1px solid #dddddd; text-align: left; padding: 8px" >EMPNO</th>'
|| '<th style="background-color: #eeeeff; border: 1px solid #dddddd; text-align: left; padding: 8px" >ENAME</th>'
|| '<th style="background-color: #eeeeff; border: 1px solid #dddddd; text-align: left; padding: 8px" >DEPTNO</th>'
|| '<th style="background-color: #eeeeff; border: 1px solid #dddddd; text-align: left; padding: 8px" >DNAME</th>'
|| '</tr>';

-- add table data
for rec in (select empno, ename, b.deptno, b.dname from emp a inner join dept b on (a.deptno=b.deptno))
loop
l_tabular_data := l_tabular_data || '<tr>'
|| '<td style="border: 1px solid #dddddd; text-align: left; padding-left: 8px;">'
|| ' <a class="button" href="' || apex_mail.get_instance_url || apex_page.get_url(p_page => 3, p_items => 'P3_PAGE_ITEM',p_values => rec.empno ) || '" target="_blank" style="font-size: 15px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #132cdb; text-decoration: none; display: inline-block;">'||rec.empno ||'</a>'
|| '</td>'
|| '<td style="border: 1px solid #dddddd; text-align: left; padding-left: 8px;">' || rec.ename || '</td>'
|| '<td style="border: 1px solid #dddddd; text-align: left; padding-left: 8px;">' || rec.deptno || '</td>'
|| '<td style="border: 1px solid #dddddd; text-align: left; padding-left: 8px;">' || rec.dname|| '</td>'
|| '</tr>';

end loop;

 l\_tabular\_data := l\_tabular\_data  || ……..  

-- close table
l_tabular_data := l_tabular_data || '</table>';

apex_mail.send( p_to => 'person@exmaple.com',

p_from => 'me@example.com',

p_body => l_tabular_data ,

p_body_html => l_tabular_data ,

p_subj => 'HTML message subject.');

apex_mail.push_queue;
end;

please note the code works except it doesn't take user to login page first that's my problem here.

Apex 24.1

thanks in advance…

Comments
Post Details
Added on Jul 14 2024
4 comments
378 views