Closed (fixed)
Project:
Inactive User
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2012 at 23:28 UTC
Updated:
15 Feb 2012 at 19:30 UTC
I don't think inactive_user_custom_settings_validate($form, &$form_state) has been validating email addresses in the E-mail Addresses' field at admin/user/inactive-user. The original code for this function:
function inactive_user_custom_settings_validate($form, &$form_state) {
$mails = explode(',', $edit['inactive_user_admin_email']);
foreach ($mails as $mail) {
if ($mail && !valid_email_address(trim($mail))) {
$invalid[] = $mail;
$count++;
}
}
if ($count == 1) {
form_set_error('inactive_user_admin_email', t('%mail is not a valid e-mail address', array('%mail' => $invalid[0])));
}
elseif ($count > 1) {
form_set_error('inactive_user_admin_email', t('The following e-mail addresses are invalid: %mail', array('%mail' => implode(', ', $invalid))));
}
}
Put anything in the E-mail Addresses field. message status will return "The configuration options have been saved."
This is the rewritten function in the patch:
function inactive_user_custom_settings_validate($form, &$form_state) {
$valid_email = $form_state['values']['inactive_user_admin_email'];
$mails = explode(',', $valid_email);
$count = 0;
foreach ($mails as $mail) {
if ($mail && !valid_email_address(trim($mail))) {
$invalid[] = $mail;
$count++;
}
}
if ($count == 1) {
form_set_error('inactive_user_admin_email', t('%mail is not a valid e-mail address', array('%mail' => $invalid[0])));
}
elseif ($count > 1) {
form_set_error('inactive_user_admin_email', t('The following e-mail addresses are invalid: %mail', array('%mail' => implode(', ', $invalid))));
}
}
The validation works now. Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| inactive_user_custom_settings_validate-d6.patch | 581 bytes | esod |
Comments
Comment #1
deekayen commentedCommitted to 6.x-1.x and master.