$status = $u->addToDatabase();
if ( !$status->isOK() ) {
- return $status;
+ if ( $status->hasMessage( 'userexists' ) ) {
+ // AuthManager probably just added the user.
+ $u->saveSettings();
+ } else {
+ return $status;
+ }
}
if ( $wgAuth->allowPasswordChange() ) {
SessionManager::singleton()->invalidateSessionsForUser( $u );
Hooks::run( 'LocalUserCreated', [ $u, $autocreate ] );
- $oldUser = $u;
- $wgAuth->initUser( $u, $autocreate );
- if ( $oldUser !== $u ) {
- wfWarn( get_class( $wgAuth ) . '::initUser() replaced the user object' );
+ if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
+ $oldUser = $u;
+ $wgAuth->initUser( $u, $autocreate );
+ if ( $oldUser !== $u ) {
+ wfWarn( get_class( $wgAuth ) . '::initUser() replaced the user object' );
+ }
}
$u->saveSettings();
$this->mAbortLoginErrorMsg = 'resetpass-expired';
} else {
Hooks::run( 'UserLoggedIn', [ $u ] );
- $oldUser = $u;
- $wgAuth->updateUser( $u );
- if ( $oldUser !== $u ) {
- wfWarn( get_class( $wgAuth ) . '::updateUser() replaced the user object' );
+ if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
+ $oldUser = $u;
+ $wgAuth->updateUser( $u );
+ if ( $oldUser !== $u ) {
+ wfWarn( get_class( $wgAuth ) . '::updateUser() replaced the user object' );
+ }
}
$wgUser = $u;
// This should set it for OutputPage and the Skin
}
/**
- * Private function to check password expiration, until AuthManager comes
- * along to handle that.
+ * Private function to check password expiration, until this is rewritten for AuthManager.
* @param User $user
* @return string|bool
*/