Alpha Video Training
Results 1 to 10 of 10

Thread: Logging Out

  1. #1
    Member
    Real Name
    Ron Leunis
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    652

    Default Logging Out

    I have managed to create a login page with username and password, which is triggered whenever anybody tries to start a page on the WAS server.

    But how can I include an option, once logged in, to log out again?

    I am thinking of: a choice in the menu system or a button.

    But which code should be triggered?


    Regards, Ron

  2. #2
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,693

    Default

    What you need to do depends on how you know someone is logged in. If you are looking to see if a variable exists, delete it. If you are testing a variable for a certain value, change it to something else.

    Quote Originally Posted by rleunis
    I have managed to create a login page with username and password, which is triggered whenever anybody tries to start a page on the WAS server.

    But how can I include an option, once logged in, to log out again?

    I am thinking of: a choice in the menu system or a button.

    But which code should be triggered?


    Regards, Ron

  3. #3
    Member
    Real Name
    Ron Leunis
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    652

    Default

    Lenny,

    Thank you for your reply. I have setup following (basically a paste of the WEBDEMO) LOGINDIALOG component at the validate event:

    Code:
    if user_name = "" .or. password = ""  then 
    	currentform.has_error = .t. 
    	currentform.error_message = "User name or password cannot be blank."
    else
    	dim correct_password as c 
    	DIM level AS N
    	
    	correct_password = lookup("[PathAlias.ADB_Path]\person","user_name=" + quote(user_name),"password")
    	if correct_password = password then
    		level = lookup("[PathAlias.ADB_Path]\person","user_name=" + quote(user_name),"level")
    		session.__protected__SecurityLevel = level
    		session.SUMA.UserName = user_name
    	ELSE
    		currentform.has_error = .t. 
    		currentform.error_message = "Invalid user name or password."
    	end if  
    end if

    Now I want the user to give an option to logout. How should I do that? Create a button with something like:

    currentform.has_error = .t.

    so the user is forced to re-login? I am not experienced with xbasic yet.

    Thanks for your help, Ron

  4. #4
    Member
    Real Name
    Ron Leunis
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    652

    Default How to logout current user

    Anybody out there?

  5. #5
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,693

    Default

    Save the following as logout.a5w

    Code:
    delete session.__protected__SecurityLevel
    response.redirect("login.a5w")
    %>
    You can change login.a5w in the second line to any URL that you would like to have displayed after the user logs out.

    Quote Originally Posted by rleunis
    Anybody out there?

  6. #6
    Member
    Real Name
    Ron Leunis
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    652

    Default logout after login

    Lenny,

    Thanks for the reply. I am assuming <%a5 needs to be placed in front of your code?

    So, like this:

    <%a5 delete session.__protected__SecurityLevel
    response.redirect("login.a5w")
    %>

    I will give this a try. Thanks again, Ron

  7. #7
    Member
    Real Name
    Ron Leunis
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    652

    Default Success

    Yes,

    Creating a page with following code in it, which can be triggered via the menu system did the trick:

    delete session.__protected__SecurityLevel
    response.redirect("login.a5w"

    Thanks again, Ron

  8. #8
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default

    Hi. I am attempting to create a logout. I like you have used the same login script, however, when i added the logout code to a new page, i am still able to access this page after i close the brower and reopen it again. I can once in add users as if i logged in properly. So my question is how do i set up the page to confirm that the login variable exists befor opening it?

    Thanks in advance.

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

    Default

    Denis,

    Go back to the examples or help text and look for procedures involving the file named logintest.a5w. You add this as an include to the top of every page you want to "test" for login. You don't add it to the LoginDialog page itself.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  10. #10
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default

    Cheers Steve, yep ive done this and all ok...... except..... after i click on the logout hyperlink which diverts to logout.a5w

    Code:
    <%a5 
    delete session.__protected__SecurityLevel
    session.reset()
    response.redirect("login.a5w")
    %>
    and I then paste the previous page URL in the address bar, the form reappears. But if i refresh the browser page it then goes back to the login page as required. Is there a solution to this. Maybe put a refresh command (if possible) on the a5w page.....?

Similar Threads

  1. Logging Errors
    By Raymond Lyons in forum Alpha Five Version 6
    Replies: 1
    Last Post: 08-05-2005, 12:29 PM
  2. logging on
    By Ian_Edwards in forum Web Application Server v6
    Replies: 2
    Last Post: 06-25-2005, 09:50 AM
  3. Logging Changes Made
    By Raheel Ahmed in forum Alpha Five Version 5
    Replies: 6
    Last Post: 03-11-2005, 02:26 PM
  4. Transaction Logging I think
    By Jimmie1234 in forum Alpha Five Version 5
    Replies: 0
    Last Post: 08-03-2004, 10:17 AM
  5. Warnnings if NOT logging in as ADMINISTRATOR
    By kumargroup in forum Alpha Five Version 5
    Replies: 1
    Last Post: 10-23-2003, 02:03 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
  •