occ user:welcome omits the password reset link by default, while occ user:add always includes it
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Bug description
The two invitation paths of the same instance send different welcome emails, and the one an
operator reaches for after a failed send is the one that cannot be acted on.
core/Command/User/Add.php:187callsgenerateTemplate($user, true)— the reset-password
link is always included.core/Command/User/Welcome.php:72calls
generateTemplate($user, $input->getOption('reset-password'))— the link is included only if
-r/--reset-passwordis passed.
Without that option, occ user:welcome sends a well-formed welcome email whose button points at
the instance root, which immediately redirects to the login page. The recipient has no password
yet and no way to set one, so the invitation is a dead end. Their only route is "forgot
password", which is precisely what the invitation was supposed to spare them.
Why this matters more than a default
This composes with #64151. There, occ user:add reports Welcome email sent even when the mail
never left, because the transport failure is swallowed. The operator sees success, the user
receives nothing, and the natural recovery is to re-send with occ user:welcome <uid>.
That re-send is the one without the link. So the sequence an operator most plausibly follows —
create, believe it worked, discover it did not, re-send — produces an email that cannot be used.
Both commands read as the obvious thing to run, and neither warns.
Steps to reproduce
occ user:add --display-name "Test" --email test@example.org testuserocc user:welcome testuser- Open the email and click the button.
Expected behaviour
Either the two paths agree, or occ user:welcome says what it is about to send. Concretely, one
of:
- default
user:welcometo including the reset link, matchinguser:add, with an opt-out for
the case where the account already has a password; or - keep the current default and print a one-line notice when the link is omitted, e.g.
Sending without a password reset link (use --reset-password to include one).
Actual behaviour
The email is sent, the command exits 0, and nothing indicates that the button leads to a login
page the recipient cannot pass.
Nextcloud version
34.0.3 (34.0.3.2), official Docker image. Both call sites were read in the running container.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with core/Command/User/Add.php:187 and core/Command/User/Welcome.php:72, comparing how each command passes the reset-password choice to generateTemplate(). Decide which documented behavior should apply to user:welcome, then verify the welcome email and command output match that behavior for both reset-link and no-link cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100