Skip to content
Snippets Groups Projects
Commit 417e2fc2 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

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

parent 847304a2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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'])));
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment