Alpha DevCon 2018
Results 1 to 11 of 11

Thread: Login Redirect Problem

  1. #1
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    196

    Default Login Redirect Problem

    I have several applications that use the same databases and, therefore, the same web security. After a successful login, the loginprocessing.a5w page is called and redirects the user to the appropriate app a5w page. To this point, the redirect was based upon the user's role. However, now I have three different apps and I would like to direct the user based on which login page they used to login.

    Suppose I have index_app1.a5w, index_app2.a5w, and index_app3.a5w. (The login component is in each of these index pages.) Is there any way I can set a variable in the index page that will persist after loginprocessing.a5w is called? If so, please explain how? I want to use the variable to do something like:

    if myvar=1
    response.redirect("app1.a5w")
    endif
    if myvar=2
    response.redirect("app2.a5w")
    end if
    if myvar=3
    response.redirect("app3.a5w")
    end if

    Any suggestions?

    Thanks,
    Donna

  2. #2
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    1,918

    Default Re: Login Redirect Problem

    Are you reusing the same login component?
    It seems like you just need to duplicate the login component then put it on the respective page and then change the login button to direct to the intended page/target.
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  3. #3
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    890

    Default Re: Login Redirect Problem

    Are you sure myvar is numeric rather than character?

  4. #4
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    196

    Default Re: Login Redirect Problem

    When you use the Alpha generated login component, the name of the a5w page that the user is directed to after a successful login is set in the security settings. Since that is the case, all login components lead to the same a5w for after login processing. That is where the problem is. If I use a UX based login component, I can bypass this problem. I'd like to use the Alpha generated login because of the way the user security is setup (I don't have access to user passwords in a table).

  5. #5
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    196

    Default Re: Login Redirect Problem

    Myvar is the big question. Is there a way to define a variable in the index.a5w that I can access in the loginprocessing.a5w that is called after a successful login? I can't think of a way to do that. I can use myvar as a numeric or character variable. My example just showed numeric.

  6. #6
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Location
    EU
    Posts
    1,409

    Default Re: Login Redirect Problem

    Hi Donna,

    You can always write your own login page.

    Here is basic code to handle the post values (from login form) userid and password and login. The point here is that variable targetpage will overwrite web securitys default redirect page.

    Code:
    dim pLogin as p
    dim pLogin.redirectURL as l
    dim targetpage as c = "myredirectpage.a5w"
    pLogin = a5ws_login_user(userid,password,targetpage)
    if pLogin.error = .T. 
        response.redirect("login.a5w") 
    else
        response.redirect(pLogin.redirectURL)
    end if

  7. #7
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,105

    Default Re: Login Redirect Problem

    You can send them to an .a5w page (setvars.a5w for example).
    On that page, you would have xbasic code that would set your session variables,
    and then redirect to a page you want the end user to see.
    The code below is an example of what you might put on the setvars.a5w page, but it should give you the general idea.
    Code:
    <%a5 
    validate = request.host
    session.remoteaddress = request.remote_addr
    session.emailfrom = "support@CompanyDomain.TLD")
    session.role = "initial_role"
    session.myvar = "myvarValue"
    session.valid = "true"
    
    
    response.redirect("loggedin.a5w")
    %>

  8. #8
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    1,918

    Default Re: Login Redirect Problem

    LOTS of great code suggestions here - thanks, guys!
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  9. #9
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    196

    Default Re: Login Redirect Problem

    Thanks for all the great input!! My problem is solved.

  10. #10
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    1,918

    Default Re: Login Redirect Problem

    what did you wind up doing?
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  11. #11
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    196

    Default Re: Login Redirect Problem

    Right now I have three apps that all access the same database. The first two redirect on login using web security's default redirect page. The third app is designed for mobile (runs in Safari) and has the login written in a UX component. I found that since my web security is setup rather strictly, I couldn't provide the "forgot password" and "change password" options without great effort. (I don't keep the password in a user table.) That's why I was contemplating using the same login as the other apps but wasn't sure how I could redirect appropriately. I believe I can do it with the targetpage variable you explained in your post. I haven't actually changed my app at this point. If the users can do password maintenance with the main app, it may not be necessary to have those options on the mobile app.

Similar Threads

  1. Mobile UX Login - Redirect if membership expired.
    By gregincolumbus in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 06-24-2014, 08:40 AM
  2. How can I determine page to redirect to after login?
    By dougeven in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 08-06-2010, 10:39 PM
  3. Redirect after login
    By patbennett in forum Application Server Version 9 - Web/Browser Applications
    Replies: 11
    Last Post: 07-21-2009, 09:43 PM
  4. Redirect After Login Not Working
    By graysarge in forum Application Server Version 8
    Replies: 3
    Last Post: 06-01-2007, 10:32 AM
  5. Login redirect by user type
    By RickK in forum Web Application Server v7
    Replies: 12
    Last Post: 09-06-2006, 12:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •