foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Fixes #10946 - Make user email optional if email is disabled

Open adamlazik1 opened this issue 1 year ago • 6 comments

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.

adamlazik1 avatar Jul 31 '24 11:07 adamlazik1

Additional commits are only temporary for easier edits.

adamlazik1 avatar Jul 31 '24 14:07 adamlazik1

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?

adamlazik1 avatar Aug 05 '24 12:08 adamlazik1

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?

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.

adamlazik1 avatar Aug 06 '24 13:08 adamlazik1

Is there a PR planned to update the documentation? For example, this section might need revision: link.

nofaralfasi avatar Aug 15 '24 16:08 nofaralfasi

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.

adamlazik1 avatar Aug 16 '24 09:08 adamlazik1

Looks like there is still error when external user tries to log in without the email. I will have to do some more changes.

adamlazik1 avatar Aug 16 '24 13:08 adamlazik1

Thank you @adamlazik1 !

adamruzicka avatar Sep 10 '24 11:09 adamruzicka

Should this always create a user with e-mail notifications disabled, even if they have a non-null e-mail? @adamlazik1 @adamruzicka

lhellebr avatar Dec 02 '24 16:12 lhellebr

I would say yes

adamruzicka avatar Dec 03 '24 08:12 adamruzicka