Skip to content

fix: while creating a new account, check for his existance#13187

Open
madbob wants to merge 1 commit into
nextcloud:mainfrom
madbob:issue_12042
Open

fix: while creating a new account, check for his existance#13187
madbob wants to merge 1 commit into
nextcloud:mainfrom
madbob:issue_12042

Conversation

@madbob

@madbob madbob commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Unsure if the duplication check should span across all existing accounts on the instance, or just those registered by the current user...

Fixes #12042

@ChristophWurst ChristophWurst self-assigned this Jul 1, 2026
@ChristophWurst ChristophWurst added bug 3. to review comp:setup All tickets regarding the setup component labels Jul 1, 2026
@ChristophWurst

Copy link
Copy Markdown
Member

Thanks for the PR

@GretaD GretaD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works, thank you

Image

@GretaD

GretaD commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

/backport to stable5.10

@GretaD

GretaD commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

would it be possible for you to write a quick test about this check?

@ChristophWurst

Copy link
Copy Markdown
Member

What I'm missing

  1. Same logic for occ mail:account:create or moved check
  2. Strategy for existing accounts
  3. (Eventually) a UNIQUE INDEX in the db because that is the only way to assure the constraint

@madbob

madbob commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author
  1. Same logic for occ mail:account:create or moved check

I'm going to check.

  1. Strategy for existing accounts

In my opinion, this cannot be retroactive. What is done, is done.

  1. (Eventually) a UNIQUE INDEX in the db because that is the only way to assure the constraint

This implementation just checks that the current user do not register multiple times the same mail account, but no one specified what happens if different users register the same mail account. If allowed: it cannot be unique in the database. If not allowed: this implementation is wrong.

@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@ChristophWurst

Copy link
Copy Markdown
Member

5. (Eventually) a UNIQUE INDEX in the db because that is the only way to assure the constraint

This implementation just checks that the current user do not register multiple times the same mail account, but no one specified what happens if different users register the same mail account. If allowed: it cannot be unique in the database. If not allowed: this implementation is wrong.

The unique index should be on (userid, email) so multiple user can set up the same email (service account etc)

Signed-off-by: Roberto Guido <info@madbob.org>

fix: checking for existance of an account also when using CLI command

Signed-off-by: Roberto Guido <info@madbob.org>
@madbob

madbob commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

I've added the check also for the CLI command.

What to do for the database? I've figured out how to create a migration, but if applied it will - of course - fail in instances where duplicated accounts already exist...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't allow duplicate account setup

4 participants