From ee6fc493a9e9ca0997216c6df3acab99c2ab80c0 Mon Sep 17 00:00:00 2001 From: stfwi Date: Fri, 24 Jun 2011 13:46:54 +0100 Subject: BugFix: Checking password for hash when user form is submitted --- HTPasswdSync.module | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/HTPasswdSync.module b/HTPasswdSync.module index f6fa48e..29a2e35 100644 --- a/HTPasswdSync.module +++ b/HTPasswdSync.module @@ -409,15 +409,20 @@ function htpasswdsync_user_delete($account) { * User insert/edit hook. Used instead of htpasswdsync_user_insert() and * htpasswdsync_user_update() because at these states the password is already * hashed. - * @param array &$edit - * @param object $account - * @param string $category + * @param string $entity_type + * @param object $entity + * @param array $form + * @param array $form_state * @return void */ function htpasswdsync_field_attach_submit($entity_type, $entity, $form, &$form_state) { if($entity_type != 'user') return; if(!empty($entity->name) && !empty($entity->pass)) { - _htpasswdsync_update($entity); + $r = db_query('SELECT pass FROM {users} WHERE uid=:uid', array(':uid' => $entity->uid)); + foreach($r as $v) { $r = $v->pass; break; } + if($r != $entity->pass) { + _htpasswdsync_update($entity); + } } } -- cgit v1.2.3