Advertisement:

Author Topic: [Fix] Logout  (Read 3071 times)

code monkey

  • Full Member
  • ***
  • Posts: 204
[Fix] Logout
« on: March 13, 2011, 06:17:47 am »
Seems the current download of OSClass doesn't include logout code.
When you click logout, nothing happens.
Here is a quick fix:

Open: /user.php

Find (line 35):
Code: [Select]
           break ;
After, on a new line, paste:
Code: [Select]
case('logout'): // logout...
if (osc_is_web_user_logged_in())
{
// Empty Instance
User::newInstance()->update(
array('s_secret' => ''),
array('pk_i_id' => '')
);

// Empty Cookie
Cookie::newInstance()->set_expires( osc_time_cookie() - (86400*365) ) ;
Cookie::newInstance()->push('oc_userId', '') ;
Cookie::newInstance()->push('oc_userSecret', '') ;
Cookie::newInstance()->set() ;
                                            
// Empty Session
Session::newInstance()->_set('userId', '') ;
Session::newInstance()->_set('userName', '') ;
Session::newInstance()->_set('userEmail', '') ;

// Prepare message
osc_add_flash_message( _m('You have logged out') ) ;
}

// Go home after log out
$this->redirectTo( osc_base_url() ) ;
break;
« Last Edit: March 13, 2011, 07:03:04 am by codeMonkey »

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: [Fix] Logout
« Reply #1 on: March 14, 2011, 12:35:55 pm »
Hi,

I think the problem is that the URL helper is wrong, since login is done in a separate file (login.php), anyway I have to check one or another.

Issue created here : http://issues.osclass.org/browse/OSCLASS-370

Thanks

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: [Fix] Logout
« Reply #2 on: March 14, 2011, 01:41:58 pm »
The problem was solved by _CONEJO three days ago: https://github.com/osclass/OSClass/commit/8c2725402a1bea2f98ebe582675c6f1305c58dc4

The logout code was in the main.php file. The issue was with the generate_rules.php that didn't redirect well. In RC5 will be solved.