Code Duplication    Length = 7-7 lines in 3 locations

includes/auth/AuthPluginPrimaryAuthenticationProvider.php 1 location

@@ 340-346 (lines=7) @@
337
			$username = User::getCanonicalName( $req->username, 'usable' );
338
			if ( $username !== false ) {
339
				$sv = \StatusValue::newGood();
340
				if ( $req->password !== null ) {
341
					if ( $req->password !== $req->retype ) {
342
						$sv->fatal( 'badretype' );
343
					} else {
344
						$sv->merge( $this->checkPasswordValidity( $username, $req->password ) );
345
					}
346
				}
347
				return $sv;
348
			} else {
349
				return \StatusValue::newGood( 'ignored' );

includes/auth/LocalPasswordPrimaryAuthenticationProvider.php 2 locations

@@ 222-228 (lines=7) @@
219
				);
220
				if ( $row ) {
221
					$sv = \StatusValue::newGood();
222
					if ( $req->password !== null ) {
223
						if ( $req->password !== $req->retype ) {
224
							$sv->fatal( 'badretype' );
225
						} else {
226
							$sv->merge( $this->checkPasswordValidity( $username, $req->password ) );
227
						}
228
					}
229
					return $sv;
230
				}
231
			}
@@ 278-284 (lines=7) @@
275
276
		$ret = \StatusValue::newGood();
277
		if ( !$this->loginOnly && $req && $req->username !== null && $req->password !== null ) {
278
			if ( $req->password !== $req->retype ) {
279
				$ret->fatal( 'badretype' );
280
			} else {
281
				$ret->merge(
282
					$this->checkPasswordValidity( $user->getName(), $req->password )
283
				);
284
			}
285
		}
286
		return $ret;
287
	}