JavaScript-based password complexity checker on account creation and password change...
[lhc/web/wiklou.git] / includes / specials / SpecialResetpass.php
index 7a549f4..de832d2 100644 (file)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  */
 
@@ -106,8 +106,11 @@ class SpecialResetpass extends SpecialPage {
        }
 
        function showForm() {
-               global $wgOut, $wgUser, $wgRequest;
+               global $wgOut, $wgUser, $wgRequest, $wgLivePasswordStrengthChecks;
 
+               if ( $wgLivePasswordStrengthChecks ) {
+                       $wgOut->addPasswordSecurity( 'wpNewPassword', 'wpRetype' );
+               }
                $self = $this->getTitle();
                if ( !$this->mUserName ) {
                        $this->mUserName = $wgUser->getName();
@@ -143,10 +146,10 @@ class SpecialResetpass extends SpecialPage {
                        wfMsgExt( 'resetpass_text', array( 'parse' ) ) . "\n" .
                        Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" .
                        $this->pretty( array(
-                               array( 'wpName', 'username', 'text', $this->mUserName ),
-                               array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ),
-                               array( 'wpNewPassword', 'newpassword', 'password', null ),
-                               array( 'wpRetype', 'retypenew', 'password', null ),
+                               array( 'wpName', 'username', 'text', $this->mUserName, '' ),
+                               array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass, '' ),
+                               array( 'wpNewPassword', 'newpassword', 'password', null, '<div id="password-strength"></div>' ),
+                               array( 'wpRetype', 'retypenew', 'password', null, '<div id="password-retype"></div>' ),
                        ) ) . "\n" .
                        $rememberMe .
                        "<tr>\n" .
@@ -165,7 +168,7 @@ class SpecialResetpass extends SpecialPage {
        function pretty( $fields ) {
                $out = '';
                foreach ( $fields as $list ) {
-                       list( $name, $label, $type, $value ) = $list;
+                       list( $name, $label, $type, $value, $extra ) = $list;
                        if( $type == 'text' ) {
                                $field = htmlspecialchars( $value );
                        } else {
@@ -186,9 +189,8 @@ class SpecialResetpass extends SpecialPage {
                        else 
                                $out .=  wfMsgHtml( $label );
                        $out .= "</td>\n";
-                       $out .= "\t<td class='mw-input'>";
-                       $out .= $field;
-                       $out .= "</td>\n";
+                       $out .= "\t<td class='mw-input'>$field</td>\n";
+                       $out .= "\t<td>$extra</td>\n";
                        $out .= "</tr>";
                }
                return $out;