Get a Jumpstart with our Sample Apps
Results 1 to 19 of 19

Thread: Log Out Control?

  1. #1
    Member
    Real Name
    Andrew W
    Join Date
    Jan 2008
    Posts
    28

    Default Log Out Control?

    Am I missing something - have searched Help and forum but can find no reference to a 'Log Out' control?

    Can I, for example, place a Button on the Tabbed UI control pane which will log the current user out and redirect back to the master log in page?

  2. #2
    Member
    Real Name
    Dale Summers
    Join Date
    Mar 2008
    Location
    Somerset, UK
    Posts
    127

    Default Re: Log Out Control?

    I'm not at my PC running Alpha, but i'm sure if you look at the web application demo there's a tabbed_ui that has a log out button.
    It uses the onclick javascript event to redirect to whatever page you want.

    Dale

  3. #3
    Moderator
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,507

    Default Re: Log Out Control?

    If you're using Alpha Five's Security Framework, there's also this function:

    A5WS_LogoutUser()
    -Steve


  4. #4
    Member
    Real Name
    Andrew W
    Join Date
    Jan 2008
    Posts
    28

    Default Re: Log Out Control?

    Thanks Dale & Steve,

    Dale - will take a look at the demo app

    Steve - how do I attach the 'A5WS_LogoutUser()' function? I have tried adding as xBasic function to an onClick event to the button but does nothing - I am not new to programming (Perl, JS etc) BUT I am an xBasic novice!

    Thanks
    Andrew

  5. #5
    Member
    Real Name
    Andrew W
    Join Date
    Jan 2008
    Posts
    28

    Default Re: Log Out Control?

    Got it sorted, thanks.
    Andrew

  6. #6
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,163

    Default Re: Log Out Control?

    The a5ws_logoutuser() function does not seem to be working. I've put it onto a screen called logout.a5w, which is called from a button on a navigation component.

    I placed it into a header as A5 code. But running it still allows me to go back using the browser back button. Should the code be placed somewhere else? I think what we are looking for is a true log-out.

    Thanks,

    Charlie

  7. #7
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,738

    Default Re: Log Out Control?

    This is a valid logout script. I have it on a LOGOUT button or link in the program. The A5W page has NO HTML, just this xbasic including the redirect at the end to take them to the home page after logout.

    However, what you are describing is not related to login/logout. Any user can press the Back button to see what was on that page. If you refresh that page, and that page is a restricted page, you will see you are actually logged out.

    a5ws_logoutuser(session,request,response)
    session.reset()
    response.redirect("index.a5w")

    line 1 logs them out
    line 2 deletes all of my session vars
    line 3 takes them to the home page
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  8. #8
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,163

    Default Re: Log Out Control?

    Thanks Steve. I really appreciate it.

    Charlie

  9. #9
    Member gkpurcey's Avatar
    Real Name
    Gordon Purcey
    Join Date
    Jul 2007
    Location
    Dallas, TX
    Posts
    276

    Default Re: Log Out Control?

    I had a similar but more basic question of how to redirect to another page (such as a log out page) from the button on a tabbed UI control.

    This code (from the sample web application) does the redirect.

    window.location='index.a5w';

    I'm fairly new to this as well, and am not completely sure as to how to do the logout from that same javascript event (on click).

  10. #10
    Member
    Real Name
    Winnie Fabellore
    Join Date
    Nov 2009
    Posts
    26

    Default Log Out Problem

    i used the session.reset() in my program and redirect to login.a5w page. but when i click the back button in the toolbar, i was able to go back to my page.

    i tried it in this msgboard site. i logged in and then i logged out, then clicked the back button and voila! i was sent back to my page.

    is this a flaw in the Alpha Five? or is it normal...?

  11. #11
    Member DW0905's Avatar
    Real Name
    Dave Wyatt
    Join Date
    Dec 2008
    Location
    Northants, UK
    Posts
    32

    Default Re: Log Out Control?

    Under Web Security - Login Options try setting the 'Ignore Return to Page after Login' option to true.
    Regards

  12. #12
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,738

    Default Re: Log Out Control?

    It is normal, and normally desired, browser behavior. Changing the 'Ignore Return..' won't cure it. It is called cache and your browser keeps a history found under the Back button.

    Someone may have found a way with Alpha to address this, but I have not. Alpha Help suggests putting this in the Head area of the page, but I find it has no effect:

    Response.AddHeader("CacheControl: no-cache")
    Response.AddHeader("Pragma: no-cache")
    Response.AddHeader("Expires: -1")

    You will also find this on the web, but it does not work when I test it:

    meta http-equiv="pragma" content="no-cache"

    Whatever fix someone comes up with, here are some rules I think would apply:

    - you can't automatically clear the client's entire browser cache on logout. Imagine how upset they would be if YOU removed their browser history, which includes history other than from your application.

    - you can't pick a solution that inhibits cache on all pages within your application because it would not run efficiently.

    - if you try a server based solution (e.g. xbasic) you have to do something that affects the cache BEFORE they log out because once the page is cached, going Back to the page does not make a run to the server, so you cannot fire any server based process to clear the screen.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  13. #13
    Member Bob Moore's Avatar
    Real Name
    Robert Moore
    Join Date
    Jul 2003
    Location
    Boston, MA
    Posts
    435

    Default Re: Log Out Control?

    If you would like to disable the browser back button, you can insert the Javascript below in the head section:

    Code:
    <script TYPE="text/javascript">window.history.forward(1);</script>
    or in the body section:

    Code:
    onload="javascript:window.history.forward(1);"
    I think this works in most browsers.

  14. #14
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,738

    Default Re: Log Out Control?

    I tested Bob's solution and it works perfectly. Here is what you do.

    Create an A5W page named logout.a5w. Put a link to this page in your application where ever you want a Logout link.

    Here is the contents of my logout.a5w page. Ignore the 'a5w_include()' statements, that is how I bring in additional html. The key is the xbasic at the top and the body onload function.

    HTML Code:
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <%a5
    a5ws_logoutuser(session,request,response)
    session.reset()
    delete session.__protected__ulink
    %>
    
    <html>
    <head>
    <meta name="generator" content="Alpha Five HTML Editor Version 9 Build 2095-3264">
    
    <%a5 a5w_include("header_head.a5w") %>
    
    </head>
    <body onload="javascript:window.history.forward(1);">
    
    
    <div id="wrapper">
    <%A5 a5w_include("header_body.a5w") %> 
    <div id="content">
    
    <h2>You have logged out. Please visit.....</h2>
    
    
    <div class="clearfix"></div>
    </div><!-- CONTENT -->
    <%A5 a5w_include("footer_body.a5w") %> 
    </div><!-- WRAPPER -->
    </body></html>
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  15. #15
    Member
    Real Name
    Garth McConnochie
    Join Date
    May 2009
    Location
    UK
    Posts
    134

    Default Re: Log Out Control?

    Hi guys,

    Now, I thought that is an excellent idea!

    so I modified my logout.a5w page to include these features.
    But the back button on my browser is still active (Firefox)
    and
    I can go back to my previous screen (tabbedUI) which has websecurity enabled with login required set
    whats's worse,

    I can then still open grids etc

    Here's the a5w page

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta name="generator" content="Alpha Five HTML Editor Version 10 Build 2787-3538">
    <!-- must use in order to make XP Themes render -->
    <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title></title>
    </head>
    <body onload=javascript:window.history.forward(1);>
    <p align=center><img src="ServiceBillingHeader.jpg"></p>
    <p>&nbsp;</p>
    <p align=center>Thankyou for using Servicebilling</p>
    <p align=center>Logout Time : <%a5

    delete session.__protected__loginid
    delete session.__protected__userid
    delete session.__protected__loginguid
    delete session.__protected__logingrp
    delete session.__protected__logindte
    a5ws_logoutuser()
    session.reset()
    ?dtoc(date(),"10")+" "+time()

    %> </p></body></html>

  16. #16
    Member DW0905's Avatar
    Real Name
    Dave Wyatt
    Join Date
    Dec 2008
    Location
    Northants, UK
    Posts
    32

    Default Re: Log Out Control?

    Now I use a TabbedUI as the main menu, and have web security set with Ignore Return to Page after login. My Redirect Page Login in Web Security is set to my login component. This works perfectly well after logging in - browsing some grids - Logout - The back button on my browser takes me back to my login screen every time, not the previously viewed grid. Obviously you must ensure that every component or page you are accessing requires login or the back button will redisplay the grid again.
    Jerry Brightbill gave me the solution to this problem several months ago (Ignore Return to Page after login).

  17. #17
    Member Bob Moore's Avatar
    Real Name
    Robert Moore
    Join Date
    Jul 2003
    Location
    Boston, MA
    Posts
    435

    Default Re: Log Out Control?

    I ran some tests this morning on disabling the browser back button and disabling page caching ... here is what I found.

    While this code will work in IE, if added to a logout page

    Code:
    <body onload="javascript:window.history.forward(1);">
    it does not work in Firefox, Safari or Chrome. There are a couple of "hack" ways to make something like this work with JavaScript in all browsers but the results are not desireable .. they flash the restricted page for a sec and then re-direct. Not a solution that I was happy with.

    In my test case, what I really wanted to accomplish was to eliminate caching of the tabbed_UI, which is my Redirect page after login.

    As it turned out, cache control, is a bit tricky with the numerous browsers acting a bit different, with Chrome being the most challenging.

    By adding the code below to the Tabbed_UI User Defined Head Content section, I was able to disable caching of the Tabbed_UI page in IE, Firefox, Safari and Chrome.

    Code:
    <%a5
    Response.Add_Header("Pragma: no-cache")
    Response.Add_Header("Cache-Control: private, max-age=0, must-revalidate, no-store")
    %>
    As such, when the user clicks the back button from my logout page, the user is redirected to my login page with all of the browsers I tested.

    Seems to work quite reliably.

  18. #18
    Member
    Real Name
    Garth McConnochie
    Join Date
    May 2009
    Location
    UK
    Posts
    134

    Thumbs up Re: Log Out Control?

    Hi Bob,

    that worked... I now get redirected back to my login screen

    thanks
    Garth

  19. #19
    Member
    Real Name
    Amit lohogaonkar
    Join Date
    Mar 2017
    Location
    NJ
    Posts
    334

    Default Re: Log Out Control?

    Thanks Steve, this worked for me.

    a5ws_logoutuser(session,request,response)
    session.reset()
    response.redirect("index.a5w")

    line 1 logs them out
    line 2 deletes all of my session vars
    line 3 takes them to the home page

Similar Threads

  1. WAS Access Log.Log large blocks of characters
    By LMOTCOB in forum Application Server Version 8
    Replies: 5
    Last Post: 01-02-2009, 12:25 PM
  2. Log file
    By ntaka in forum Alpha Five Version 8
    Replies: 2
    Last Post: 11-08-2007, 10:24 AM
  3. can't log in
    By Conrad Lindes in forum Application Server Version 8
    Replies: 3
    Last Post: 10-02-2007, 12:50 AM
  4. Log-In Help
    By vinyltap in forum Web Application Server v7
    Replies: 16
    Last Post: 03-07-2006, 05:47 PM
  5. Log Off
    By Louis Nickerson in forum Web Application Server v6
    Replies: 7
    Last Post: 02-24-2005, 02:49 PM

Posting Permissions

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