contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
122 stars 57 forks source link

Registration Module sends Activation E-Mail even if `Send activation e-mail` is NOT checked when Re-Registering #1526

Closed mvscheidt closed 6 years ago

mvscheidt commented 6 years ago

Steps to Recreate the Issue in the Demo:

  1. Create Registration Module with the following Settings themes_ _contao_official_demo_ _front_end_modules_ _edit_module_id_64_-_contao_open_source_cms_-_2018-05-14_10 46 03
  2. Add Registration Module somewhere on https://demo.contao.org/en/user.html
  3. Go to https://demo.contao.org/en/user.html and register with an E-Mail.
  4. You will land on the page https://demo.contao.org/en/user.html again without any special message, no Mail will be send.
  5. Now try to Re-register again with the same E-Mail.
  6. You will land on the page https://demo.contao.org/en/user.html again and the module has output a message "The activation mail has been re-sent to your e-mail address."

6. should not happen in my opinion and seems like a bug. Reason is because if I do not want to send any activation E-Mails this means I want to activate the users manually.

I read the Code and I think all that needs to be done is to change this

        // Check for a follow-up registration (see #7992)
        if (\Input::post('email', true) != '' && ($objMember = \MemberModel::findUnactivatedByEmail(\Input::post('email', true))) !== null)
        {
            $this->resendActivationMail($objMember);

            return;
        }

to this

        // Check for a follow-up registration (see #7992)
        if ($this->reg_activate && \Input::post('email', true) != '' && ($objMember = \MemberModel::findUnactivatedByEmail(\Input::post('email', true))) !== null)
        {
            $this->resendActivationMail($objMember);

            return;
        }

However I haven't tested what happens then, so maybe some additional changes are required.

Maybe in this case a message like Administrator has not activated your account yet would be appropriate, but not sure what would be best here seeing how this might require new translations to be made.

leofeyer commented 6 years ago

I think your fix is correct.

leofeyer commented 6 years ago

Fixed in 8c65ec8f5c8877cab776ae4336a8ef5b857a55b2. Thank you @mvscheidt.