Tweak audit hooks
This commit is contained in:
parent
a52a3acd8b
commit
50c317ff98
3 changed files with 15 additions and 6 deletions
|
|
@ -409,10 +409,11 @@ after noinclude/includeonly/onlyinclude and other processing.
|
|||
&$text: string containing partially parsed text
|
||||
&$this->mStripState: Parser's internal StripState object
|
||||
|
||||
'LoginBadPass': a login attempt has failed with an invalid password.
|
||||
No return data is accepted; this hook is for auditing only.
|
||||
'LoginAuthenticateAudit': a login attempt for a valid user account either succeeded or failed.
|
||||
No return data is accepted; this hook is for auditing only.
|
||||
$user: the User object being authenticated against
|
||||
$password: the password being submitted and found wanting
|
||||
$retval: a LoginForm class constant with authenticateUserData() return value (SUCCESS, WRONG_PASS, etc)
|
||||
|
||||
'LogPageValidTypes': action being logged. DEPRECATED: Use $wgLogTypes
|
||||
&$type: array of strings
|
||||
|
|
|
|||
|
|
@ -211,19 +211,23 @@ class PreferencesForm {
|
|||
|
||||
if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
|
||||
if ( $this->mNewpass != $this->mRetypePass ) {
|
||||
wfRunHooks( "PrefsPasswordAudit", array( $wgUser, $this->mNewpass, 'badretype' ) );
|
||||
$this->mainPrefsForm( 'error', wfMsg( 'badretype' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$wgUser->checkPassword( $this->mOldpass )) {
|
||||
wfRunHooks( "PrefsPasswordAudit", array( $wgUser, $this->mNewpass, 'wrongpassword' ) );
|
||||
$this->mainPrefsForm( 'error', wfMsg( 'wrongpassword' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$wgUser->setPassword( $this->mNewpass );
|
||||
wfRunHooks( "PrefsPasswordAudit", array( $wgUser, $this->mNewpass, 'success' ) );
|
||||
$this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
|
||||
} catch( PasswordError $e ) {
|
||||
wfRunHooks( "PrefsPasswordAudit", array( $wgUser, $this->mNewpass, 'error' ) );
|
||||
$this->mainPrefsForm( 'error', $e->getMessage() );
|
||||
return;
|
||||
}
|
||||
|
|
@ -321,6 +325,9 @@ class PreferencesForm {
|
|||
$wgUser->setCookies();
|
||||
$wgUser->saveSettings();
|
||||
}
|
||||
if( $oldadr != $newadr ) {
|
||||
wfRunHooks( "PrefsEmailAudit", array( $wgUser, $oldadr, $newadr ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( $needRedirect && $error === false ) {
|
||||
|
|
|
|||
|
|
@ -400,17 +400,18 @@ class LoginForm {
|
|||
// reset form; bot interfaces etc will probably just
|
||||
// fail cleanly here.
|
||||
//
|
||||
return self::RESET_PASS;
|
||||
$retval = self::RESET_PASS;
|
||||
} else {
|
||||
wfRunHooks( 'LoginBadPass', array( $u, $this->mPassword ) );
|
||||
return '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS;
|
||||
$retval = '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS;
|
||||
}
|
||||
} else {
|
||||
$wgAuth->updateUser( $u );
|
||||
$wgUser = $u;
|
||||
|
||||
return self::SUCCESS;
|
||||
$retval = self::SUCCESS;
|
||||
}
|
||||
wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $retval ) );
|
||||
return $retval;
|
||||
}
|
||||
|
||||
function processLogin() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue