Index: trunk/phase3/includes/Html.php |
— | — | @@ -195,6 +195,17 @@ |
196 | 196 | |
197 | 197 | $ret = ''; |
198 | 198 | foreach ( $attribs as $key => $value ) { |
| 199 | + # For boolean attributes, support array( 'foo' ) instead of |
| 200 | + # requiring array( 'foo' => 'meaningless' ). |
| 201 | + if ( is_int( $key ) |
| 202 | + && in_array( strtolower( $value ), self::$boolAttribs ) ) { |
| 203 | + $key = $value; |
| 204 | + } |
| 205 | + |
| 206 | + # Not technically required in HTML 5, but required in XHTML 1.0, |
| 207 | + # and we'd like consistency and better compression anyway. |
| 208 | + $key = strtolower( $key ); |
| 209 | + |
199 | 210 | # See the "Attributes" section in the HTML syntax part of HTML 5, |
200 | 211 | # 9.1.2.3 as of 2009-08-10. Most attributes can have quotation |
201 | 212 | # marks omitted, but not all. (Although a literal " is not |
Index: trunk/phase3/includes/specials/SpecialResetpass.php |
— | — | @@ -128,6 +128,8 @@ |
129 | 129 | } |
130 | 130 | |
131 | 131 | function pretty( $fields ) { |
| 132 | + global $wgMinimalPasswordLength; |
| 133 | + |
132 | 134 | $out = ''; |
133 | 135 | foreach ( $fields as $list ) { |
134 | 136 | list( $name, $label, $type, $value ) = $list; |
— | — | @@ -135,11 +137,17 @@ |
136 | 138 | $field = htmlspecialchars( $value ); |
137 | 139 | } else { |
138 | 140 | $attribs = array( 'id' => $name ); |
139 | | - # All three fields are required, and we should focus the first |
140 | | - # (wpPassword) |
141 | | - $attribs['required'] = ''; |
| 141 | + # The current password field is never required; it's possible |
| 142 | + # that existing users might have empty passwords on any wiki. |
| 143 | + # The two other password fields are required if |
| 144 | + # $wgMinimalPasswordLength > 0 (not allowed to set an empty |
| 145 | + # password). |
| 146 | + if ( ( $name == 'wpNewPassword' || $name == 'wpRetype' ) |
| 147 | + && $wgMinimalPasswordLength > 0 ) { |
| 148 | + $attribs[] = 'required'; |
| 149 | + } |
142 | 150 | if ( $name == 'wpPassword' ) { |
143 | | - $attribs['autofocus'] = ''; |
| 151 | + $attribs[] = 'autofocus'; |
144 | 152 | } |
145 | 153 | $field = Html::input( $name, $value, $type, $attribs ); |
146 | 154 | } |