Code Duplication    Length = 13-18 lines in 2 locations

includes/auth/LocalPasswordPrimaryAuthenticationProvider.php 1 location

@@ 288-300 (lines=13) @@
285
		}
286
287
		$req = AuthenticationRequest::getRequestByClass( $reqs, PasswordAuthenticationRequest::class );
288
		if ( $req ) {
289
			if ( $req->username !== null && $req->password !== null ) {
290
				// Nothing we can do besides claim it, because the user isn't in
291
				// the DB yet
292
				if ( $req->username !== $user->getName() ) {
293
					$req = clone( $req );
294
					$req->username = $user->getName();
295
				}
296
				$ret = AuthenticationResponse::newPass( $req->username );
297
				$ret->createRequest = $req;
298
				return $ret;
299
			}
300
		}
301
		return AuthenticationResponse::newAbstain();
302
	}
303

includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php 1 location

@@ 342-359 (lines=18) @@
339
		$req = AuthenticationRequest::getRequestByClass(
340
			$reqs, TemporaryPasswordAuthenticationRequest::class
341
		);
342
		if ( $req ) {
343
			if ( $req->username !== null && $req->password !== null ) {
344
				// Nothing we can do yet, because the user isn't in the DB yet
345
				if ( $req->username !== $user->getName() ) {
346
					$req = clone( $req );
347
					$req->username = $user->getName();
348
				}
349
350
				if ( $req->mailpassword ) {
351
					// prevent EmailNotificationSecondaryAuthenticationProvider from sending another mail
352
					$this->manager->setAuthenticationSessionData( 'no-email', true );
353
				}
354
355
				$ret = AuthenticationResponse::newPass( $req->username );
356
				$ret->createRequest = $req;
357
				return $ret;
358
			}
359
		}
360
		return AuthenticationResponse::newAbstain();
361
	}
362