-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw error message when a user with email address as uid exists #36050
Conversation
While looking into the UsersController.php there is a room for improvement to use UserCreateService. I was thinking to make it as a separate PR/task. Let me know if that's ok or not. |
I'm not sure if this is a good idea. Users have an uid and an email (among other things). Whether the guests app uses the email as uid is irrelevant because for core is just another uid, what is important is that the guests app also sets the email as email. |
Codecov Report
@@ Coverage Diff @@
## master #36050 +/- ##
==========================================
- Coverage 54.01% 53.85% -0.16%
==========================================
Files 63 63
Lines 7404 7377 -27
Branches 1309 1301 -8
==========================================
- Hits 3999 3973 -26
Misses 3019 3019
+ Partials 386 385 -1
Continue to review full report at Codecov.
|
If I understand the comment correctly you mean to say the core might be handling case of same email address already. But as per my observation the core does not. The core allows to have same email address for different users. In fact I wonder why can't we allow multiple users with same email address. Or say what would cause wrong if 2 different users have same email address. Though I know that allowing multiple users having same email address would contradict to this PR ( that's fine ). |
If we want to prevent duplicate emails, a DB constraint is the way to go. The fact that there is a DB index which allows duplicated values in the email means that core is fine allowing duplicated values for whatever reason.
The solution, as said, is to put a constraint in the DB. If core hasn't made that change yet, I guess core is fine having duplicated emails for whatever reason.
Emails are intended to be personal and private. Admins use email to comunicate with the users. This can involve password resets, activity traces, and other personal information that you don't want anyone to see. Obviously, if the user uses public or shared email accounts, it's his responsability |
Totally agree with you. The only problem is when we touch the DB, we need to have migrations for the same.
Agreed. |
a8c2722
to
5ca0021
Compare
The email address associated with username should be unique. Signed-off-by: Sujith H <sharidasan@owncloud.com>
5ca0021
to
0b1456d
Compare
Modified the PR with following changes:
|
I guess, this is not an good idea. Different users may have the same mail-address for testing purposes. |
When admin creates user we should check the users
with username as email address exists.
Signed-off-by: Sujith H sharidasan@owncloud.com
Description
Lets consider a scenario where a user with username as email address exist ( for instance a guest user). And admin tries to create another user say
user1
with the email address of guest user. The user should not be created. And an error message should be displayed. This PR addresses the same. I have made the error message same as for:a) when the user exists and admin tries to create the same user.
b) The user names differ, but one of the username is same as the email address of new user to be created.
Related Issue
Motivation and Context
A check to forbid the user creation when a user is created with same email address of a guest user.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: