summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Phillips2006-09-22 22:17:12 (GMT)
committer Chad Phillips2006-09-22 22:17:12 (GMT)
commit8e188ee0896c07c26d9715b20d807afff41470e1 (patch)
treed8a43f7387d9f3dcd7559a6311b015aa67175744
parent210b6ded26c944dc0ee3a19c3565f7c4e37f20d1 (diff)
#83273 -- Improve password validation. patch by torne. add validation to user/x/edit.
-rwxr-xr-xlogintoboggan.module16
1 files changed, 16 insertions, 0 deletions
diff --git a/logintoboggan.module b/logintoboggan.module
index cc3959e..69ab9fd 100755
--- a/logintoboggan.module
+++ b/logintoboggan.module
@@ -103,6 +103,7 @@ function logintoboggan_form_alter($form_id, &$form) {
}
break;
case 'user_edit':
+ $form['#validate'] += array('logintoboggan_user_edit_validate' => array());
$user = user_load(array('uid' => arg(1)));
$id = logintoboggan_validating_id();
$in_pre_auth_role = in_array($id, array_keys($user->roles));
@@ -340,6 +341,21 @@ function logintoboggan_user_register_validate($form_id, $form_values) {
}
/**
+ * Custom validation function for user edit form
+ *
+ * @ingroup logintoboggan_form
+ */
+function logintoboggan_user_edit_validate($form_id, $form_values) {
+ if (strlen($form_values['pass'])) {
+ // if we're changing the password, validate it
+ $pass_err = logintoboggan_validate_pass($form_values['pass']);
+ if ($pass_err) {
+ form_set_error('pass', $pass_err);
+ }
+ }
+}
+
+/**
* Implementation of hook_init()
*
* @ingroup logintoboggan_core