Fixes #10946 - Make user email optional if email is disabled
Currently, users without email are asked to input one even if they do not have email enabled on the Email preferrences tab. Also, the user cannot submit a blank email as this too leads to an error message.
To verify this, you can create a new user without an email and then impersonate him or log in as the user. The behavior is the same for users with internal and external authentication.
I saw there were attemps before to make the email optional (#9279), but it seems that the behavior changed since this PR was merged. I am building up on this previous effort.
Also resolves another Redmine issue 34666.
Additional commits are only temporary for easier edits.
In users_controller_test.rb on line 408, I think the test is failing because after the subsequent login the user email becomes blank, which no longer gets evaluated as an error. I don't know whether I should delete this test or change its behavior so it still checks behavior on subsequent logins on another example, if there is such. Any ideas?
In
users_controller_test.rbon line 408, I think the test is failing because after the subsequent login the user email becomes blank, which no longer gets evaluated as an error. I don't know whether I should delete this test or change its behavior so it still checks behavior on subsequent logins on another example, if there is such. Any ideas?
I just removed the second part of the test asserting error after blank email, I am willing to change it if anyone has better idea.
Is there a PR planned to update the documentation? For example, this section might need revision: link.
Is there a PR planned to update the documentation? For example, this section might need revision: link.
Thank you for pointing that out, I will bring it to the documentation team.
Looks like there is still error when external user tries to log in without the email. I will have to do some more changes.
Thank you @adamlazik1 !
Should this always create a user with e-mail notifications disabled, even if they have a non-null e-mail? @adamlazik1 @adamruzicka
I would say yes