summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-05-12 09:07:18 +0000
committerDries Buytaert <dries@buytaert.net>2009-05-12 09:07:18 +0000
commit417e2fc2bb64bd869886a1549d0e7dc860d1cbcf (patch)
tree3c7804eccd3c5fdb8696e4e30e6b1a470c026a20
parent847304a2934b062544e87160ec8524e9275e8247 (diff)
downloadbrdo-417e2fc2bb64bd869886a1549d0e7dc860d1cbcf.tar.gz
brdo-417e2fc2bb64bd869886a1549d0e7dc860d1cbcf.tar.bz2
- Patch #399248 by deekayen: detect when a signature is too long to prevent SQL errors.
-rw-r--r--modules/user/user.module9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 0611c53e6..d15bfcdee 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -961,6 +961,15 @@ function user_user_validate(&$edit, &$account, $category = NULL) {
form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $edit['mail'], '@password' => url('user/password'))));
}
}
+
+ // Make sure the signature isn't longer than the size of the database field.
+ // Signatures are disabled by default, so make sure it exists first.
+ if (isset($edit['signature'])) {
+ $user_schema = drupal_get_schema('users');
+ if (strlen($edit['signature']) > $user_schema['fields']['signature']['length']) {
+ form_set_error('signature', t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['fields']['signature']['length'])));
+ }
+ }
}
}