OpenEnergyPlatform / oeplatform

Repository for the code of the Open Energy Platform (OEP) website. The OEP provides an interface to the Open Energy Family
http://openenergyplatform.org/
GNU Affero General Public License v3.0
62 stars 19 forks source link

After registration: Mail not shown #1836

Open ebroda opened 2 months ago

ebroda commented 2 months ago

Description of the issue

I registered in the OpenEnergyPlatform and afterwards got the following message, with my E-Mail-Adress missing. But still the activation mail was send correctly.

oep_mail

Feels like, user.email, is not set correctly. https://github.com/OpenEnergyPlatform/oeplatform/blob/d30c4f0f88b8cf791863140f8ef874898aa93a19/login/templates/login/activate.html#L18

Steps to Reproduce

  1. Register at openenergyplatform.org
  2. See message without mail.

Ideas of solution

Context and Environment

Workflow checklist

jh-RLI commented 1 month ago

Hm, that's strange. I'll check that again, at least it worked until a few weeks ago.

Edit - nope wasnt working before ... that is what you get if tests are missing :O

jh-RLI commented 1 month ago

The email field is filled in at this point, but a redirect is made to the page shown above. During the redirect the context of the user creation form is lost and therefore at this point it is not really possible to transfer the available data about the new user to the form as there is no information and no token available yet (as the user has to click on the link in the activation email first) with which to determine the current user. Well, I don't like this implementation at all, but I think for now I'll just somehow include the user data as context in the view. I will probably have to change the implementation though.

https://github.com/OpenEnergyPlatform/oeplatform/blob/18622747355f8a7f7164ac85781754b645fc2c12/login/views.py#L831

ebroda commented 1 month ago

Okay, sound's not to good. Maybe a temporary setting to the session could do that? Like including it in the register-process (only the email) and then get and remove it here (probably something like https://docs.djangoproject.com/en/5.1/topics/http/sessions/#examples).

But to continue that: Does the form below to change the email work correctly, if we have no token and no user? So how does the OEP know to which user it should assign the given e-mail address and resend the mail?