Email address removed if captcha wrong

Hi,
Im using the buildin subscriber page with “Display email confirmation” and captcha plugin. As fields, I have email, confirm email, name, phone, dropdown list with cities, checkbox for age, checkbox for terms and conditions,the lists to suscribe and captcha. Order of fields is as described and they are all required.
Now, if i enter values to all fields except cities(dropdown), terms and conditions checkbox, one of lists and captcha, form is not submitted and captcha error message is displayed although the error message should be first for the cities and the second checkbox. Also after the error, email has to be entered again in the first email field although it still exists in the confirmation field.
Now, if i enter captcha and press submit again, i get the error for required fields (cities and 2nd checkbox). Also email has to be entered again. If I enter city, checkbox and captcha, again I get the error that a list is not selected and email also has to be entered again.

What should be done :

  1. Email address should not not be removed every time form is not submitted because of required fields
  2. First check that all required fields are entered and a list is selected and then check for captcha.

Something else that I found while I was editing the preferences page, is that captcha should be required there because if you enter your email and submit, every time you press submit again and again, you get emails. That also happens if you refresh page again and again after first submit. This can get your email blacklisted.

Finally, I have added the autocomplete=off to all forms because personal data where visible from previous entries.

Im using v3.4.0

Regards
George

This might be fixed by reordering the error reporting code so that a missing field is reported before a plugin field error (which is what the captcha is). See file admin/subscribelib2.php, line 699

} elseif ((isset($_POST['subscribe']) || isset($_POST['update'])) && $pluginResult) {
    $msg = '<div class="error missing">'.$pluginResult.'</div><br/>';
} elseif ((isset($_POST['subscribe']) || isset($_POST['update'])) && $missing) {
    $msg = '<div class="error missing">'."$strValuesMissing: $missing".'</div><br/>';

change to

} elseif ((isset($_POST['subscribe']) || isset($_POST['update'])) && $missing) {
    $msg = '<div class="error missing">'."$strValuesMissing: $missing".'</div><br/>';
} elseif ((isset($_POST['subscribe']) || isset($_POST['update'])) && $pluginResult) {
    $msg = '<div class="error missing">'.$pluginResult.'</div><br/>';

The preferences page should be including the captcha field. If you do not see that then you might be using a subscribe page that has not enabled captcha.
image

1 Like

hi, thanks for the reply,

Unfortunately i don’t see tha captcha in unsubscribe and preferences page, although i upgrated phplist to 3.4.1 (from 3.4.0). Captcha is only visible in subscribe page. Include captcha in the subscribe page is set to enable in subscription page settings.

George

@merovatis I guess that the subscriber you are using does not have the subscribe page that you expect. If you look at the subscriber details you can see their subscribe page

image

The preferences page is based on the subscribe page indicated.

@duncanc Subscibe page is fine, i think that in index.php the captcha plugin is not loaded in functions unsubscribe, preferences, only in subscribe function. I tried to add the following code

foreach ($GLOBALS[‘plugins’] as $pluginname => $plugin) {
if ($plugin->enabled) {
$html .= $plugin->displaySubscriptionChoice($GLOBALS[‘pagedata’], $userid);
}
}

captcha is visible now but it doenst stop process if captcha is wrong, nore i get error messages.

@merovatis that code is already present in index.php for the preferences page, line 519

 foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
    if ($plugin->enabled) {
        $html .= $plugin->displaySubscriptionChoice($GLOBALS['pagedata'], $userid);
    }
}

as well as for subscribe page at line 678.

@duncanc The code at line 519 is for the form, after you enter the preferences page from a link in the email. Captcha is missing at index.php?p=preferences where it asks for your email!
Also if you go to index.php?p=unsubscribe, there is no captcha.

@merovatis I think that you are only confirming that phplist doesn’t do exactly what you want.
You will need to raise a issue on the issue tracking system https://mantis.phplist.org/view_all_bug_page.php if you want plugins to be called at other points in the processing.