Modify UserLoginComplete and UserLogoutComplete hooks to allow HTML injection into the success page by hooks. For CentralAuth 'global logging in'
This commit is contained in:
parent
da24ff6b5a
commit
ac930bf819
4 changed files with 12 additions and 6 deletions
|
|
@ -1119,6 +1119,7 @@ $user: User to get groups for
|
|||
|
||||
'UserLoginComplete': after a user has logged in
|
||||
$user: the user object that was created on login
|
||||
$inject_html: Any HTML to inject after the "logged in" message.
|
||||
|
||||
'UserLoginForm': change to manipulate the login form
|
||||
$template: SimpleTemplate instance for the form
|
||||
|
|
@ -1128,6 +1129,7 @@ $user: the user object that is about to be logged out
|
|||
|
||||
'UserLogoutComplete': after a user has logged out
|
||||
$user: the user object _after_ logout (won't have name, ID, etc.)
|
||||
$inject_html: Any HTML to inject after the "logged out" message.
|
||||
|
||||
'UserRights': After a user's group memberships are changed
|
||||
$user : User object that was changed
|
||||
|
|
|
|||
|
|
@ -603,12 +603,14 @@ class LoginForm {
|
|||
|
||||
# Run any hooks; ignore results
|
||||
|
||||
wfRunHooks('UserLoginComplete', array(&$wgUser));
|
||||
$injected_html = '';
|
||||
wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html));
|
||||
|
||||
$wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
$wgOut->setArticleRelated( false );
|
||||
$wgOut->addWikiText( $msg );
|
||||
$wgOut->addHtml( $injected_html );
|
||||
if ( !empty( $this->mReturnTo ) ) {
|
||||
$wgOut->returnToMain( $auto, $this->mReturnTo );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@ function wfSpecialUserlogout() {
|
|||
|
||||
$wgUser->logout();
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
$wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
|
||||
|
||||
// Hook.
|
||||
$injected_html = '';
|
||||
wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html) );
|
||||
|
||||
$wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html );
|
||||
$wgOut->returnToMain();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1976,7 +1976,6 @@ class User {
|
|||
global $wgUser;
|
||||
if( wfRunHooks( 'UserLogout', array(&$this) ) ) {
|
||||
$this->doLogout();
|
||||
wfRunHooks( 'UserLogoutComplete', array(&$wgUser) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue