From 2477a631eb7b6dbcfe5368da1886e5f0c84e3427 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 5 Aug 2010 16:18:43 +0200 Subject: [PATCH] Uses default password checker and hasher JS function in admin page. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- htdocs/javascript/password.js | 4 ++++ modules/admin.php | 7 ++++--- templates/admin/user.tpl | 11 ++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/javascript/password.js b/htdocs/javascript/password.js index 4e8b1b9..578e345 100644 --- a/htdocs/javascript/password.js +++ b/htdocs/javascript/password.js @@ -20,6 +20,7 @@ function hashResponse(password1, password2, hasConfirmation) { pw1 = $('[name=' + password1 + ']').val(); + if (hasConfirmation) { pw2 = $('[name=' + password2 + ']').val(); if (pw1 != pw2) { @@ -27,7 +28,10 @@ function hashResponse(password1, password2, hasConfirmation) { return false; } $('[name=' + password2 + ']').val(''); + } else if (pw1 == '********') { + return true; } + if (pw1.length < 6) { alert("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !"); return false; diff --git a/modules/admin.php b/modules/admin.php index 70418e4..92a6493 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -433,12 +433,12 @@ class AdminModule extends PLModule Post::s('sex'), $user->profile()->id()); } } - if (!Post::blank('hashpass')) { - $to_update['password'] = Post::s('hashpass'); + if (!Post::blank('pwhash')) { + $to_update['password'] = Post::s('pwhash'); require_once 'googleapps.inc.php'; $account = new GoogleAppsAccount($user); if ($account->active() && $account->sync_password) { - $account->set_password(Post::s('hashpass')); + $account->set_password(Post::s('pwhash')); } } if (!Post::blank('weak_password')) { @@ -640,6 +640,7 @@ class AdminModule extends PLModule $page->addJsLink('jquery.ui.core.js'); $page->addJsLink('jquery.ui.tabs.js'); + $page->addJsLink('password.js'); // Displays last login and last host information. $res = XDB::query("SELECT start, host diff --git a/templates/admin/user.tpl b/templates/admin/user.tpl index 895f7ff..7db27fa 100644 --- a/templates/admin/user.tpl +++ b/templates/admin/user.tpl @@ -35,13 +35,6 @@