Skip to content

Commit

Permalink
Add rainlab.user.logout event
Browse files Browse the repository at this point in the history
  • Loading branch information
vmlavro committed Jun 13, 2016
1 parent d16c4e8 commit 5d9721d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ This plugin will fire some global events that can be useful for interacting with

- **rainlab.user.beforeAuthenticate**: Before the user is attempting to authenticate using the Account component.
- **rainlab.user.login**: The user has successfully signed in.
- **rainlab.user.logout**: The user has successfully signed out.
- **rainlab.user.deactivate**: The user has opted-out of the site by deactivating their account. This should be used to disable any content the user may want removed.
- **rainlab.user.reactivate**: The user has reactivated their own account by signing back in. This should revive the users content on the site.

Expand Down
7 changes: 7 additions & 0 deletions components/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ public function onRun()
*/
public function onLogout()
{
$user = Auth::getUser();

Auth::logout();

if ($user) {
Event::fire('rainlab.user.logout', [$user]);
}

$url = post('redirect', Request::fullUrl());
Flash::success(Lang::get('rainlab.user::lang.session.logout'));

Expand Down

0 comments on commit 5d9721d

Please sign in to comment.