Code Duplication    Length = 13-18 lines in 2 locations

includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php 1 location

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

includes/auth/LocalPasswordPrimaryAuthenticationProvider.php 1 location

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