- Patch #399248 by deekayen: detect when a signature is too long to prevent SQL errors.

merge-requests/26/head
Dries Buytaert 2009-05-12 09:07:18 +00:00
parent 847304a293
commit 417e2fc2bb
1 changed files with 9 additions and 0 deletions

View File

@ -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')))); 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'])));
}
}
} }
} }