Impossible to disconnect with remember me option

Hi,

I can’t log out when I use the “Remember me” option, do you know how to do it?

I have an entry in my menu that points to ap_login but it doesn’t work

Thanks

in your menu, you must ceate one opcion for exit.

Ok Alvagar, one option to … what’s app ?

Thanks

This is because your logout link is the login app and it reconnect because the remember option. It’s a loop

I created a blank app with this code, and put the blank app in the link of exit option

image

Hi

@Alvagar

I have the same configuration as you, but it doesn’t work.

@gbillot3

Exactly! However, your solution does not delete the cookie. There is no mechanism provided in Scriptcase to delete the connection cookie?

Thanks

It is working for me. The Leave target is doing his work I think. I do not inspect the compile code.

Try adding this to the blank app

if(isset($_COOKIE[‘PHPSESSID’]))
{
unset($_COOKIE[‘PHPSESSID’]);
setcookie(“PHPSESSID”, ‘’,time()-3600,’/’);
}

1 Like

Thanks, it’s interesting, but it doesn’t work. When I test on my localhost server, it destroys the Scriptcase application session and I lose my session :wink:

Thank you VERY MUCH, this is my solution in app blank :

if(isset($_COOKIE['usr_data'])) {
	unset($_COOKIE['usr_data']);
	setcookie('usr_data', '',time()-3600,'/');
	
	sc_redir('ap_Login');
}

The usr_data cookie is the “remember me” cookie. If you delete it the login is going to ask for the user and password again.

What is the point of using the remember me option on security, if you are going to delete it?

The code that I sent before destroy the session on the production server so the user can’t return back.

Bye

@gbillot3 Your solution is the right way to do it

@Yannick_Pavard Use $_SERVER[‘REMOTE_ADDR’] to check if you are on your local server and decide what you want to do in that situation

1 Like

Hi guys,

@gbillot3

  1. I want to be able to log out so that I can reconnect with another user
  2. For security, a user needs to log off at the end of the day to protect data access if someone wants to use their computer in their absence.

@jlboutin60 Why is my solution not good? Does it work locally and in production, isn’t ?

Thanks

If you want to use multiple user on the same computer you need to be sure that the session is completely erase.

The problem with erasing usr_data is that you are also destroying the user/password information, which is contrary to the remember me option like @gbillot3 says in a previous comment

You can use the erase solution on remote computer and erase the usr_data on your development server if that is what you want

So, your problem from the beginning was to use the “remember me” option. on security

If you are not going to use it, generate the security again without that option.

My goal of using Remembe be is to prevent the user from reconnecting several times a day by going to the www.website.com/connexion/ or www.website.com/menu/ page.

If I don’t use this option, I always get an error message when I load the page www.website.com/menu/ or the reconnection form when arriving at www.website.com/connexion.

In a day, a user can reconnect 10 times if he closes his browser page for example.

Thank you

If you erase the cookies, the user will now be able to reconnect 10 times without closing is browser page

Disable Enable direct call by URL in security if you don’t want the user to bypass the user login page

Sorry I think my messages translated with google translate are not understood.

Your code satisfies me for the moment, I will test all this in the long term and adapt according to the server if necessary

Good day

Hi,

It’s interesting what I found in this post here Cookies not clearing correctly in security module - 'Remember Me'

It’s even easier, without the need to create an empty application.