Jump to content

Recommended Posts

Posted

I noticed there is a user::logout method and according to the docs it requires the users "session" to be passed in; my question is how do I get this information for the user to pass to the user::logout method?

 

Thanks!

Posted

It doesn't look like this method is designed to be called via the API. You would need to instantiate a Session object and select the users session using their session ID, which will be stored in a cookie on the users computer. You could search through the session data on the DB for the client id but it would be messy.

Posted
  On 9/14/2014 at 9:48 AM, flangefrog said:

It doesn't look like this method is designed to be called via the API. You would need to instantiate a Session object and select the users session using their session ID, which will be stored in a cookie on the users computer. You could search through the session data on the DB for the client id but it would be messy.

 

Thanks for the reply.

 

Basically what I am doing is I am using the shared login plugin cody made to log the user into Blesta at the same time as they log into our main site, so when they log out of our main site I want to log them out of Blesta as well.

Posted
  On 9/14/2014 at 10:34 AM, flangefrog said:

I think that just as you redirect the client to a login url (or make a get request), you would do the same but use the logout url.

 

If I just redirected them to the logout URL then that's where they would end; I need the process to be seamless so they end up back on the main page of the site - which is where they are sent now when they log out.

Posted

If you can't get the user to make a get request and you need it to be seamless then you could get Blesta to redirect users to your main page after logging out. So there will be two redirects upon logging out of your main site.

Posted
  On 9/14/2014 at 11:06 AM, flangefrog said:

If you can't get the user to make a get request and you need it to be seamless then you could get Blesta to redirect users to your main page after logging out. So there will be two redirects upon logging out of your main site.

 

Well I'm sure I can redirect the user via a GET request to the blesta log out, but not sure how to get blesta to do a redirect after logging them out?

Posted

I was referring to an ajax get request. If you want to do a redirect then modify this line in app/controllers/client_logout.php

$this->redirect($this->base_uri . "login");
Posted
  On 9/14/2014 at 11:19 AM, flangefrog said:

 

I was referring to an ajax get request. If you want to do a redirect then modify this line in app/controllers/client_logout.php

$this->redirect($this->base_uri . "login");

 

Oh ok - thanks!

Posted
  On 9/14/2014 at 11:19 AM, flangefrog said:

 

I was referring to an ajax get request. If you want to do a redirect then modify this line in app/controllers/client_logout.php

$this->redirect($this->base_uri . "login");

 

Hmmm ok, had a look at this. Pretty new to working with the blesta code myself, is there a way I can extend this or something so I can change it so I can pass in a redirect url or something? Because it will vary depending on the environment (dev/test/prod).

Posted
  On 9/14/2014 at 9:55 AM, gutterboy said:

Thanks for the reply.

 

Basically what I am doing is I am using the shared login plugin cody made to log the user into Blesta at the same time as they log into our main site, so when they log out of our main site I want to log them out of Blesta as well.

you need to use setSessionCookie function

setSessionCookie( string $path = "", string $domain = "", boolean $secure = false )

then you can get a shared $_SESSION .

you need to set

$_SESSION['blesta_id'] = $user->id;

$_SESSION['blesta_client_id'] = $client->id;

after the logout destory the session .

Posted
  On 9/14/2014 at 2:08 PM, naja7host said:

you need to use setSessionCookie function

setSessionCookie( string $path = "", string $domain = "", boolean $secure = false )

then you can get a shared $_SESSION .

you need to set

$_SESSION['blesta_id'] = $user->id;

$_SESSION['blesta_client_id'] = $client->id;

after the logout destory the session .

 

Hmmmm..... I'd prefer to do it another way, but if I chose to do it that way where would I put that code? You mean in our main system?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...