How to redirect to different page after login in APEX 4.1

Dear All,
Here my Requirement is,When the users login,
when they entered their username and password and pressed login button,
they have to redirected to different pages based on the type of user.
Here my LOGIN_TABLE has following 3 columns,
1.Username
2.Password
3.Type.
The TYPE has 2 values, employee and admin.
when the type is admin they should be redirected to page 2,
reaining i.e employee users has to be redirected to page 3.
How can I do this? please give some suggestion.
Thank you.
regards,
Gurujothi

Dear Christian,
Thank you for your reply,
I would like to explain something,
When I using the following function,
*create or replace FUNCTION custom_auth_g (
p_username IN VARCHAR2,
p_password IN VARCHAR2)
RETURN BOOLEAN IS
BEGIN
FOR c1 IN (SELECT 1
FROM login_table
WHERE upper(username) = upper(p_username)
AND upper(password) = upper(p_password))
LOOP
RETURN TRUE;
END LOOP;
RETURN FALSE;
END;*
When login, It checks in the login_table table and if the username is exist with the pass word it successfully entered inside the application.
for all users only one page which we set.
My Login_table also contains type which has 2 type as I mentined above.
But As I mentioned earliar based on the user type it has to be redirected to 2 different page.
I found this Package but I cant understand,Can you please Explain?
*create or replace PACKAGE app_security_pkg
AS
PROCEDURE add_user
p_username IN VARCHAR2
,p_password IN VARCHAR2
PROCEDURE login
p_uname IN VARCHAR2
,p_password IN VARCHAR2
,p_session_id IN VARCHAR2
,p_flow_page IN VARCHAR2
FUNCTION get_hash
p_username IN VARCHAR2
,p_password IN VARCHAR2
RETURN VARCHAR2;
PROCEDURE valid_user2
p_username IN VARCHAR2
,p_password IN VARCHAR2
FUNCTION valid_user
p_username IN VARCHAR2
,p_password IN VARCHAR2
RETURN BOOLEAN;
END app_security_pkg;*
*create or replace PACKAGE BODY app_security_pkg
AS
PROCEDURE login
p_uname IN VARCHAR2
,p_password IN VARCHAR2
,p_session_id IN VARCHAR2
,p_flow_page IN VARCHAR2
IS
lv_goto_page NUMBER DEFAULT 1;
BEGIN
-- This logic is a demonstration of how to redirect
-- to different pages depending on who successfully
-- authenticates. In my example, it simply demonstrates
-- the ADMIN user going to page 1 and all other users going
-- to page 2. Add you own logic here to detrmin which page
-- a user should be directed to post authentication.
IF UPPER(p_uname) = 'ADMIN'
THEN
lv_goto_page := 1;
ELSE
lv_goto_page := 2;
END IF;
APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');
wwv_flow_custom_auth_std.login
p_uname => p_uname,
p_password => p_password,
p_session_id => p_session_id,
p_flow_page => p_flow_page || ':' || lv_goto_page
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END login;
PROCEDURE add_user
p_username IN VARCHAR2
,p_password IN VARCHAR2
AS
BEGIN
INSERT INTO app_users (username, PASSWORD)
VALUES (UPPER (p_username),
get_hash (TRIM (p_username), p_password));
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
RAISE;
END add_user;
-- Function to Perform a oneway hash of the users
-- passwords. This cannot be reversed. This exmaple
-- is a very week hash and if been used on a production
-- system, you may want to use a stronger hash algorithm.
-- Read the Documentation for more info on DBMS_CRYPTO as
-- this is the supported package from Oracle and
-- DBMS_OBFUSCATION_TOOLKIT is now depricated.
FUNCTION get_hash (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
RETURN DBMS_OBFUSCATION_TOOLKIT.md5 (
input_string => UPPER (p_username)
|| '/'
|| UPPER (p_password));
END get_hash;
PROCEDURE valid_user2 (p_username IN VARCHAR2, p_password IN VARCHAR2)
AS
v_dummy VARCHAR2 (1);
BEGIN
SELECT '1'
INTO v_dummy
FROM app_users
WHERE UPPER (username) = UPPER (p_username)
AND PASSWORD = get_hash (p_username, p_password);
EXCEPTION
WHEN NO_DATA_FOUND
THEN raise_application_error (-20000, 'Invalid username / password.');
END valid_user2;
FUNCTION valid_user (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN BOOLEAN
AS
BEGIN
valid_user2 (UPPER (p_username), p_password);
RETURN TRUE;
EXCEPTION
WHEN OTHERS
THEN RETURN FALSE;
END valid_user;
END app_security_pkg;*
And you said "assign an URL to FSP_AFTER_LOGIN_URL, depending on the Type column",
Where to assign,Could you please Explain?
Thank you.

Similar Messages

  • How to redirect to a page after login fails?

    Since I am working on an automated login from Forms I would like the login page to redirect to an error page if the login fails. I can't seem to find an option for this.
    I am using a public page that branches to 101 with BRANCH_TO_PAGE_ACCEPT, but when login fails I see this login page.
    Instead of that I would like to redirect to a public page that shows a message.
    How can I do this?
    Wendy

    A login failure is when the user and/or pass is not correct. I do not want to show page 101 but a different page when this happens.
    I am using the default login page but I am calling it with BRANCH_TO_PAGE_ACCEPT so the user never sees it and I want to keep it that way....

  • How to redirect a JSP page after the session is killed

    Hello!
    I am quite new to JSP. I have a question about how to redirect a jsp page after the session is killed. Could anyone help?
    thanks a lot in advance!

    You can't, directly. There's no connection betweenthe server and browser.
    even after invalidating the session. we can do it
    directly using the statement
    response.sendRedirect("....");
    or we can use the meta refresh tag.if session is invalidated and if we try to do response.sendRedirect(".. ") it throws IllegalStateException

  • How to tRetrieving a web page after login

    I have a requirement to connect to a site and get an html content. This need to be implemented using URLConnection.
    But the problem is that I need to sucessfully complete a login form first, inorder to reach that page. so how I can do this login programatically?
    Can I first connect to the login url to submit the data and use the same connection object to go to the next page. Is it the way I should do it? I mean this will take care of all the cookies, headers etc that the remote server needs for the second time?
    TIA,
    dw

    By login page, do you mean an actualy web page that contains login information or a basic authentication popup. If it is basic authentication, then you can just pass the user name and password as part of the header.

  • Redirect to different pages based on user input value

    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    Orton

    orton607 wrote:
    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    OrtonI have a similar scenario in my application and this is how I handle it.
    1. Create a page item on the page, say Px_PAGE_NUM
    2. Create a "On Submit - After Computations and Validations" page process to set the above page item. In your case, you can use the same logic that you have already in place (except the call to OWA_UTIL.REDIRECT_URL) :
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
       :Px_PAGE_NUM := '1';
    end if;
    if v_job = 'MANAGER' then
       :Px_PAGE_NUM := '10';
    end if;
    end;3. Create a "On Submit: After processing" branch. Specify the "Target Type" as "Page in the application" and "Page Number" as &Px_PAGE_NUM. (with the dot).
    I hope the above helps.
    BTW, the following thread in the forum related to OWA_UTIL.REDIRECT_URL might help:
    issue OWA_UTIL.REDIRECT_URL with APEX 4.1.1

  • How to navigate to different page with different user name

    Hi,
    I have created a DB application....
    My application consist of 4 pages.......
    But if the first user logs into an application means, he needs to see only 3rd page
    If the second user logs into an application means, he needs to see only 4th page.......
    (i.e) 3rd page couldnot been accessible by the second user........
    and 4th page couldnot been accessible by the first user.......
    How to achieve this, i think i need to set some validation in the login page.....if so how to do that.....
    it is an urgency....help me friends....
    Regards,
    Harry...

    Hi,
    Thanks for your reply, so i need to create a post authentication for redirecting to different page as you said....
    Since these are my two pages(in the application)
    *) issues page.
    *) analyst page.
    Suppose if the User A login to the issues page(via. login page) he needs to see only the issues page
    if the User B login to the analyst page(via. login page) he needs to see only the analyst page...
    Since User A and B have access to the application.....
    But A should login only to issues page in my application and he should not login to the analyst page...
    and B should login only to analyst page in my application and he should not login to the issues page...
    For that where i need to define the post authentication...whether in login page i need to define.....
    if so, whether i need to define sql query for restricting the users to the particular page in the post authentication...
    Regards,
    Harry...

  • How to Redirect to other page

    Hi,
    i have a select list and a button, when i click the button, i would like it to follow the selection from the select list and redirect to different page. I have total 2 pages, page 1 and page 2. I created a selected list named "P2_GROUPBY", and a button named "Filter".
    And i create a process to cater the logic of it.
    {color:#333399}begin
    case
    When :P2_GROUPBY = 'PRDFML' then{color}
    {color:#008000}-- Code i should redirect to page 2{color}
    {color:#333399}When :P2_GROUPBY = 'FAMILY' then{color}
    {color:#008000}-- Code i should redirect to page 3{color}
    {color:#333399} end case;
    end;
    {color:#000000}Please help me with this matter,
    Thank you.
    Best Regards
    Vincent.
    {color}{color}

    Varad,
    Thank you for the suggession, i did try your method, and i created a process to set the setting, somehow, the page still post back to the original page.
    my Process:
    page1
    {color:#000080}Begin
    if :F117_PAGE is not null then{color} {color:#008000}-- :F117_Page is application item so i do not need to created in other page.{color}
    {color:#000080}:F117_PAGE := '';
    end if;
    {color}
    {color:#000080} case
    When :P2_GROUPBY = 'PRDFML' then
    :F117_PAGE := 2;
    :P2_TESTING := :F117_PAGE;
    When :P2_GROUPBY = 'FAMILY' then
    :F117_PAGE := 3;
    :P2_TESTING := :F117_PAGE;
    end case;
    end;
    {color}
    *{color:#000000}Branching to URL identified by Item.*
    *{color}*After the process, this branch will trigger by the "filter" button, and go to that particular page.
    I put branch action to:
    :F117_PAGE
    Somehow, the page still redirect to the current page.
    ~Vincent.

  • How to add two different page numbers in a single page

    How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.

    It's quite complicated, see
    Two Page Numbering Schemes in the Same Document.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to redirect to other page in a dialogListener?

    Hi All,
    I am using JDeveloper 11g with ADF BC.
    How to redirect to another page from a dialogListener of <af:dialog>?
    I have a page with a [Delete] button on it. When user click on the delete button, a confirmation dialog will appear to ask "Are you sure? [Yes/No]". If user answer [Yes], I will delete the current record, and go to another page. I can call a Operation Binding in the dialogListener, but I don't know how to go to another page.
    public void handleDeleteDialog(DialogEvent dialogEvent) {
    OperationBinding operationBinding = bindings.getOperationBinding("Delete");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    // redirect to another page?
    Regards,
    Samson Fu

    Hi Samson,
    Check following link for your query:-
    Re: page has to navigate to the next page when  clicking button in the popup
    You can also make usae of Navigation Handler to invoke the navigation action in your task flow as
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "ActionNameInTaskFlow");
    Vikram

  • Get the subsequent page after login

    I would like to retrieve the content of site that required the login using userid and password via post method. I am able to login using HttpUrlConnection by setting method to POST providing the id and password. However when I tried to access the subsequent pages (after login) by issuing new HttpUrlConnection, it said I've not login. I believe this is something to do with cookies setting which is done internal by browser. If we login using browser, and type in the subsequent page, the browser will direct to the correct page. But in actual Java program environment, it does seem to be working this way. Can anyone help?
    thx.

    Show us the code, please.

  • How to redirect to a page dynamically after authentication Apex

    We have developed an application and the application id is 333.
    we have developed a login screen(page No. 111).
    After login Company page (Page No.1) will appear where the user selects the company name.
    Once company is selected, the control goes to Menu Page(Page No.10). The menu will be displayed based on the user rights.
    In shared Components - Authentication scheme,
         In session Not Valid region, URL option is selected and URL is assigned as "we have given "f?p=&APP_ID.:111:&SESSION."
         In Logout URL, URL option is enabled and URL is assigned as "f?p=&APP_ID.:111"
    In shared Components - Security Attributes,
         In Authentication region, in HOME link "f?p=&APP_ID.:1:&SESSION." is assigned
    In login page (Page No. 111), we have created a process "On Submit - After computation and validations".
         in that
              we are checking a condition like
              if the user has access to Only one company then he will be redirected to Menu_page(Page No.10).
              if the user has access to more than one company then he will be redirected to Company Page(Page No.1).
    if "No. of company access" =1 then
    wwv_flow_custom_auth_std.login (p_uname => :p111_username,
    p_password => :p111_password,
    p_session_id => v ('APP_SESSION'),
    p_flow_page => :app_id||':10'
    else
    wwv_flow_custom_auth_std.login (p_uname => :p111_username,
    p_password => :p111_password,
    p_session_id => v ('APP_SESSION'),
    p_flow_page => :app_id||':1'
    end if;
    The above condition is not working. ie. it is always loading Company Page(Page No.1) even if the user has access to one company alone.
    Can anyone point out the place where I have done wrong. Or please suggest me a method to achieve the above said task.

    Hi User490632,
    During the login,
    it using the custom authentication function which I mentioned below,
    *create or replace FUNCTION custom_auth_g (
    p_username IN VARCHAR2,
    p_password IN VARCHAR2)
    RETURN BOOLEAN IS
    BEGIN
    FOR c1 IN (SELECT 1
    FROM login_table
    WHERE upper(username) = upper(p_username)
    AND upper(password) = upper(p_password))
    LOOP
    RETURN TRUE;
    END LOOP;
    RETURN FALSE;
    END;*
    its working fine, If I give the username and password which exist in the table login_table.
    Now I need to redirect to 2 different pages.
    if the username is 'guru' then when he clicked the login button he has to redirect to page 2,
    if username is any other name except 'guru' they have to be redirected to page 3.
    Can you please give the step by step procedure to follow?
    Thank you.
    Regards,
    gurujothi

  • How to make it go to a designated page after login

    Hello Experts,
    I have a simple problem but i havent been able to figure it out. I have a simple application that has several public pages and only one "reports" page that requires login.
    When I am in the "reports" page, I click login and after entering my credentials, the application takes me to page 1. (I actually want to to go to page 5 "the reports page")
    I tried creating a branch in the login page so that after the login button is presed that it will take me to the reports page... but it didnt work...
    Any idea how to make it go to the "reports" page and not the default page after I log in?
    Thanks a lot!!

    The login process on the login page contains the following plsql:
    wwv_flow_custom_auth_std.login(
    P_UNAME => v('P101_USERNAME'),
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||':36'
    in this case after login page 36 is started.
    change the number in the desired page.
    Fred.

  • Navigate to correct page after login

    Hi Ben
    I have a list of links that navigate to different pages. Some of the pages that the links navigate to require authorisation, so page 101 is presented to the user. When the user successfully logs in, page 101 directs them to page 1 (home). How can I make the users experience smoother by taking them on to the page that they expected to go to. Some times this page will be in a different application.
    Thank You
    Ben

    Ben,
    When you use that first format (P_FLOW_PAGE => :APP_ID||':1'), the result should be that the after-login page is the page originally requested (the deep link). If no page was requested, say you just specified the application ID in the run link, then the after-login page will be the current application's page 1.
    When you use that second format (P_FLOW_PAGE => :APP_ID), the result should be that the after-login page is the page originally requested (the deep link). If no page was requested, say you just specified the application ID in the run link, then the application's Home Link attribute would be used for the after-login URL.
    Scott

  • Problem in how to stop displaying previous page after Logout

    <%
    // I invalidate all my session when i logout and comes on Login.jsp page but if i go back still it open
    previous pages
    How i can stop these
    i am adding these line in avery jsp page
    1)
    response.setHeader("pragma","no-cache");
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Cache-Control","no-store");
    response.addDateHeader("Expires", 0);
    response.setDateHeader("max-age", 0);
    response.setIntHeader ("Expires", -1); //prevents caching at the proxy server
    response.addHeader("cache-Control", "private"); //IE5.x only;
    %>
    2) and in Logout.jsp
    response.sendRedirect("Login.jsp");
    session.invalidate();
    session.removeAttribute("viv");
    still on reaching login page i can move to previous page by clicking back button

    Hi sreenathreddy.
    I am doing exactly what you are talking about.
    On load of each jsp page, I check to see if I am still in session. If i am not, i redirect the user to the login page saying his session has expired.. This works perfectly fine in the sense that after I log out, if I directly type in the url or click on any other link from history, it redirects you to the login page.
    But my problem sitll remained that after logging out, if i clicked the back button, it would still take me to the previous page even though none of the links on that page would work.
    So i added all the response.SetHeaders that are mentioned in this discussion.
    Now the scenario is such that, when i press the back button after logging out, it tells me that the page has expired and i have to resubmit the form.
    There are two problems with this
    1. at this point , if i refresh my page, it still gets the details from the server and even though i am invalidating the session and all the user details, and checking to see if the session is invalidated,it still somehow manages to get all the details(i dont know where that info is stored)
    2. even if the person has not logged out. ie in the middle of a perfectly valid session and clicks on the back button, he is warned that the session has expired.
    please do reply
    thanks
    ritesh

  • How to hide discoverer connection page after opening discoverer plus?

    Hi,
    I invoke the following url in browser window 1 to open Oracle DIscoverer Plus.
    I notice the browser window 1 will open a window (say i call it browser window 2) to display the Oracle Discoverer Plus application.
    Once the Oracle Discoverer Plus java applet is fully loaded, the browser window 1 will show the Connect to Discoverer Plus page.
    I wonder if we can configure not to show this page as my users might confuse to see a few existing connections listed there and in fact if possible, I don't want user to see the list of connections.
    Anyway to get rid of the page?
    Please advise.
    Thank you.

    I am trying to use URL parameters to keep Discoverer Plus from launching a new window after login. I notice that what works in Discoverer Viewer does not work in Discoverer Plus.
    The following works with Discoverer Viewer :
    <iframe src="https://cohort50.spinsys.com:8251/discoverer/viewer?framedisplaystyle=embedded"
    width="100%" height=100%></iframe>
    After Viewer login the next page displays in the same window, just as I want it to.
    Discoverer Plus behaves differently. If I try this with Discoverer Plus a new window is launched after successful login. I also tried adding the pluspopup=false parameter to the URL, but the problem remains.
    Neither of the following two fragments prevent a new window from launching after successful login to Discoverer Plus :
    <iframe src="https://cohort50.spinsys.com:8251/discoverer/plus?framedisplaystyle=embedded"
    width="100%" height=100%></iframe>
    <iframe src="https://cohort50.spinsys.com:8251/discoverer/plus?framedisplaystyle=embedded&_plus_popup=false"
    width="100%" height=100%></iframe>
    Does anybody have any advice for me? What must I do?

Maybe you are looking for

  • Update statement is not working(urgent)

    Hi, when i use below code it gives me dump when reocrds arem ore. loop at itab.   update de1000 SET vrprs = itab-rfwrt   where kaufn = itab-vbelv   and mtpos IN  soption and perio =  perio and VRPRS <> 0. endloop. the structure of itab and de11000 is

  • What is the cloud and how do i use it

    what is the cloud and how do i use it

  • DIfferent OC4J containers for each Component

    So far all the information I've read is related to SCA modeler, etc... I still haven't found info about how this components actually works inside OAS, for example, in ORACLE 10.1.3.3 ESB had to main components, ESB RT and ESB DT. My question is, will

  • E61 - Email config

    Hi everyone. I am looking to get the E61 but would like to confident that it can be configured to my work Exchange server for push mail. We use Windows Small Business Server 2003, MS exchange, cisco firewall. I am not a techy ,(could you tell!) but o

  • How do I remove image capture

    Since I installed OSx 10.10, very time I connect a phone, iPad, CF card or SD card, Image Capture opens and tries to subvert my workflow. How do I stop this? Yes I know I can tell each device to do nothing. But with hundreds to thousands of devices t