beyond-all-reason / teiserver

Middleware server for online gaming
https://www.beyondallreason.info/
MIT License
47 stars 47 forks source link

Delete reset token if email failure #290

Closed geekingfrog closed 1 month ago

geekingfrog commented 2 months ago

Address https://github.com/beyond-all-reason/teiserver/issues/289

If, for whatever reason, sending the password reset email fails, then attempt to delete the reset code so that the operation can be retried.

Also fixed a template so that flashes are shown on the login page as well.

This is what the admin UI looks like: 2024-05-18-971x497-scrot 2024-05-18-1010x577-scrot

and this is what the user facing interface looks like: 2024-05-18-1937x473-scrot 2024-05-18-1937x386-scrot

geekingfrog commented 2 months ago

Also tested the flow when registering a new user through chobby, and got the email fine:

2024-05-19-734x170-scrot

StanczakDominik commented 1 month ago

For the sake of testing, how would you force that password reset email send to fail?

geekingfrog commented 1 month ago

For the sake of testing, how would you force that password reset email send to fail?

I rebased this branch on top of latest master, this way it's using the new config system. In the integration server, the easiest would be to change the host/password for the mailer configuration to something that will fail. This way, any attempt to send an email would fail and trigger this codepath.

Locally I force the email integration and don't start the local docker container that simulate the smtp server (same thing as putting a wrong hostname).

I don't think there's a way to test that without config/code change otherwise.