Code Duplication    Length = 12-12 lines in 2 locations

maintenance/changePassword.php 1 location

@@ 58-69 (lines=12) @@
55
		}
56
		$password = $this->getOption( 'password' );
57
		try {
58
			if ( $wgDisableAuthManager ) {
59
				$user->setPassword( $password );
60
			} else {
61
				$status = $user->changeAuthenticationData( [
62
					'username' => $user->getName(),
63
					'password' => $password,
64
					'retype' => $password,
65
				] );
66
				if ( !$status->isGood() ) {
67
					throw new PasswordError( $status->getWikiText( null, null, 'en' ) );
68
				}
69
			}
70
			$user->saveSettings();
71
			$this->output( "Password set for " . $user->getName() . "\n" );
72
		} catch ( PasswordError $pwe ) {

maintenance/createAndPromote.php 1 location

@@ 125-136 (lines=12) @@
122
		if ( $password ) {
123
			# Try to set the password
124
			try {
125
				if ( $wgDisableAuthManager ) {
126
					$user->setPassword( $password );
127
				} else {
128
					$status = $user->changeAuthenticationData( [
129
						'username' => $user->getName(),
130
						'password' => $password,
131
						'retype' => $password,
132
					] );
133
					if ( !$status->isGood() ) {
134
						throw new PasswordError( $status->getWikiText( null, null, 'en' ) );
135
					}
136
				}
137
				if ( $exists ) {
138
					$this->output( "Password set.\n" );
139
					$user->saveSettings();