Question

I want to redirect the post login page to a change login page. I have a custom authentication schema which call user_mng.authenticate as authentication function.

function authenticate(p_username in VARCHAR2, p_password in VARCHAR2) RETURN BOOLEAN IS 
ntype int;
      pwobf varchar2(100);
      BEGIN
        pwobf:=obfuscate(nvl(p_password,'**'));
        select user_role
        into ntype 
        from( select 1 user_role 
             from view_users
             where upper(user_id)=upper(p_username)
              and password=p_password
             union all
             select 2 user_role
             from view_users
             where upper(user_id)=upper(p_username)
              and password=pwobf);      
        apex_util.set_authentication_result(0);   
        RETURN TRUE;
      exception when no_data_found then
        apex_util.set_authentication_result(1);
        return false;
      END authenticate;

you can find below a printscreen of the login page

http://gyazo.com/10dc90b9e271ae11fadfa48201665a3d.png

The login page is pretty much the one automatically created by APEX where in the post submit LOGIN process I have added

begin APEX_CUSTOM_AUTH.LOGIN (
    p_uname       => :P101_USERNAME,
    p_password    => :P101_PASSWORD,
    p_session_id  => V('APP_SESSION'),
    p_app_page    => :APP_ID||':18');end;

where page 18 is my target page while 1 is the home page.

I don't know why, most of the time the page is sent to the home... I haven't be able to relate to any other condition but from time to time it goes to the change login page. If in the p_app_page => :APP_ID||':18' I set an invalid page a receive an error (the page is being read) as well if I set an invalid password (the auth. process is working) during the login.

I've tried to clean browser cache... but it does not appear to have any effect.

I'm using Apex 4.2.4 with Tomcat 7. I would deeply appreciate any help.

Regards

Was it helpful?

Solution

the villain is the deep link. Solved as follows

declare
vpg varchar2(10):=':1';
begin
 APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');
 IF user_mng.need_psw_rst(:P101_USERNAME) then
   vpg:=':18';
 end if;
 APEX_CUSTOM_AUTH.LOGIN (
    P_UNAME       => :P101_USERNAME,
    P_PASSWORD    => :P101_PASSWORD,
    P_SESSION_ID  => v('APP_SESSION'),
    p_app_page   => :APP_ID||vpg
    );
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top