Page MenuHomePhabricator

User.php.diff

Authored By
bzimport
Nov 21 2014, 10:40 PM
Size
2 KB
Referenced Files
None
Subscribers
None

User.php.diff

Index: includes/User.php
===================================================================
--- includes/User.php (revision 52368)
+++ includes/User.php (working copy)
@@ -614,8 +614,13 @@
return false;
// Password needs to be long enough, and can't be the same as the username
- return strlen( $password ) >= $wgMinimalPasswordLength
- && $wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName );
+ if( strlen( $password ) < $wgMinimalPasswordLength ) {
+ throw new PasswordError( wfMsgExt( 'passwordtooshort', array( 'parsemag' ),
+ $wgMinimalPasswordLength ) );
+ } elseif ( $wgContLang->lc( $password ) === $wgContLang->lc( $this->mName ) ) {
+ throw new PasswordError( wfMsg( 'passwordsameasuser' ) );
+ }
+ return true;
}
/**
@@ -1699,11 +1704,7 @@
throw new PasswordError( wfMsg( 'password-change-forbidden' ) );
}
- if( !$this->isValidPassword( $str ) ) {
- global $wgMinimalPasswordLength;
- throw new PasswordError( wfMsgExt( 'passwordtooshort', array( 'parsemag' ),
- $wgMinimalPasswordLength ) );
- }
+ $this->isValidPassword( $str );
}
if( !$wgAuth->setPassword( $this, $str ) ) {
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 52368)
+++ languages/messages/MessagesEn.php (working copy)
@@ -956,8 +956,9 @@
Please try again.',
'wrongpasswordempty' => 'Password entered was blank.
Please try again.',
-'passwordtooshort' => 'Your password is invalid or too short.
-It must have at least {{PLURAL:$1|1 character|$1 characters}} and be different from your username.',
+'passwordtooshort' => 'Your password is too short.
+It must have at least {{PLURAL:$1|1 character|$1 characters}}.',
+'passwordsameasuser' => 'Your password is invalid. It must be different from your username.',
'mailmypassword' => 'E-mail new password',
'passwordremindertitle' => 'New temporary password for {{SITENAME}}',
'passwordremindertext' => 'Someone (probably you, from IP address $1) requested a new

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5336
Default Alt Text
User.php.diff (2 KB)

Event Timeline