Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/14258] Add event into auth::login before session creation #4004

Merged
merged 3 commits into from
Oct 24, 2015
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions phpBB/phpbb/auth/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ function _set_group_hold_ary(&$hold_ary, $option_id, $setting)
function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container;
global $phpbb_dispatcher;

$provider_collection = $phpbb_container->get('auth.provider_collection');

Expand Down Expand Up @@ -982,6 +983,24 @@ function login($username, $password, $autologin = false, $viewonline = 1, $admin
redirect($url);
}

/**
* TEvent is triggered after checking for valid username and password, and before the actual session creation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEvent? :)

*
* @event core.auth_login_session_create_before
* @var array login Variable containing login array
* @var bool admin Boolean variable whether user is logging into the ACP
* @var string username Username of user to log in
* @var bool autologin Boolean variable signaling whether login is triggered via auto login
* @since 3.1.7-RC1
*/
$vars = array(
'login',
'admin',
'username',
'autologin',
);
extract($phpbb_dispatcher->trigger_event('core.auth_login_session_create_before', compact($vars)));

// If login succeeded, we will log the user in... else we pass the login array through...
if ($login['status'] == LOGIN_SUCCESS)
{
Expand Down