fix: fault tolerant email login and user creation#31399
fix: fault tolerant email login and user creation#31399dieselftw wants to merge 7 commits intoRocketChat:developfrom
Conversation
|
hugocostadev
left a comment
There was a problem hiding this comment.
Would be better to do this on the API level, since both endpoints can be used with an API
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #31399 +/- ##
===========================================
+ Coverage 54.52% 54.58% +0.05%
===========================================
Files 2290 2286 -4
Lines 50315 50249 -66
Branches 10271 10258 -13
===========================================
- Hits 27435 27427 -8
+ Misses 20385 20336 -49
+ Partials 2495 2486 -9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hey @hardikbhatia777 thanks a lot for your contribution! Another contributor did also made a contribution that's is better and fix around others endpoints/frontend with a simple solution, so we are going to keep with his solution |
@hugocostadev I respect your decision but I'm a bit confused. The issue specifically asked for fault tolerance in the login field, like Google has (it doesn't give an error if you have white spaces, instead it trims it down for you). This is a quality-of-life feature, where you won't have to worry about copying a few extra white spaces along with the email address. Modifying the regex isn't fault tolerant and not good for the end-user since they'll have to spend an extra few seconds every time to delete the white spaces and be extra careful while copying. The API endpoints can be adjusted to support trimming as well. This is just a suggestion of course, I do still respect your decision! Thanks. |
|
I agree with @hardikbhatia777. Raising an error creates unnecessary overhead. The user might not even realize their mistake because enclosing white spaces are not clearly visible. The resulting error message is not helpful ("Invalid e-mail address"). The issue can easily happen on mobile devices with an auto-completion app that automatically adds a white space after words. I would prefer a QoL solution that gracefully trims enclosing white space without letting the user know. |
|
Thanks for both feedbacks @hardikbhatia777 and @david-uhlig , I'm going to check internally and get back to you guys... We can reopen this if necessary. Thanks |
|
Hey guys, so... We would suggest doing this in the backend, the methods that uses email ... In this file Check another files if uses something with email too... Would be very nice to add API tests for it too, if possible. Thanks again for your feedback, this makes a strong community 🚀 |
4ddb607 to
85f1ade
Compare
|
@hugocostadev I've made the necessary changes in all the files I could find the email field in. I'm unsure about how to write API tests though (I have written basic unit tests before, but I'm unsure of how to do it here). I'd appreciate your help in that regard :) Thanks! |
|
@hardikbhatia777 you can add api tests by going into the tests file, in this case the path would be: |
@Gustrb Thanks a lot for your guidance. Another issue was posted by the same person who posted this issue. I want to draw your attention there since it's very much relevant and related to this issue. It has to do with streamlining and normalizing the email parser for all endpoints. I'd appreciate if you could have the internal team look into it. #31518 Since this issue is almost fixed, I'll go ahead and add the tests so it's fixed and closed :) Thanks! |
|
@hardikbhatia777 yea sure, I will take a look into the issue with the team, thanks for the heads up 🚀 |
85f1ade to
1fb0bc1
Compare
|
Hey @Gustrb, I've added an API test for this in the file that you mentioned. Can you please review the changes and let me know if everything is in order? Thanks! |
|
Hey @Gustrb @hugocostadev would you mind following up on this please? Thanks! |
0e18fb3 to
acd9178
Compare
|
PS. Please excuse the ugly commit history, I switched PCs and ended up messing up my fork. Apologies for that. |
Proposed changes (including videos or screenshots)
This PR introduces fault tolerance to email fields while logging in and creating users (as administrator).
2024-01-08.23-02-29.mp4
Issue(s)
fixes #31397
Steps to test or reproduce
Admin mistake
User mistake
Logout.
Further comments
Bonus documentation grammar fix :)
I feel like there should be some unit tests for this? Let me know.