Skip to content
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

[Bug]: "Resend welcome email" does not contain link to set initial password #41005

Closed
5 of 8 tasks
pReya opened this issue Oct 20, 2023 · 4 comments · Fixed by #41038
Closed
5 of 8 tasks

[Bug]: "Resend welcome email" does not contain link to set initial password #41005

pReya opened this issue Oct 20, 2023 · 4 comments · Fixed by #41038
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: emails feature: users and groups good first issue Small tasks with clear documentation about how and in which place you need to fix things in.

Comments

@pReya
Copy link

pReya commented Oct 20, 2023

⚠️ This issue respects the following points: ⚠️

Bug description

If you create a new user in the UI and DON'T set a password, the user will receive a welcome E-Mail containing a button/link with the caption "Set your password" ("Setze dein Passwort" in German). It links to https://cloud.bla.de/lostpassword/reset/form/abcsomeToken123/MisterUsername.

However, when the admin triggers this E-Mail again via the "Resend welcome mail" button next to the user in the "Users" admin section, the second E-Mail will have different content: It will not contain the same button caption/link. Instead it will only have a link to the home page of the cloud – not to the password set/reset form.

Steps to reproduce

  1. Create a new user via the Admin UI (don't set a password, just username and email)
  2. User receives an e-mail with "Set your password" link (don't do it)
  3. Resend the email with the "three dots" button next to the user entry
  4. User receives another e-mail with a different content/no password set/reset link

Expected behavior

The second E-Mail should be identical to the first E-Mail

Installation method

Community Docker image

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@pReya pReya added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Oct 20, 2023
@joshtrichards
Copy link
Member

Looks like the resend option defaults to excluding the password reset token, but when we add a user we first check to see if the password is empty. If it is, we include the password reset token. Seems we need to add the same check in the resend.

$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);

public function generateTemplate(IUser $user, $generatePasswordResetToken = false) {

if ($password === '') {
if ($email === '') {
throw new OCSException('To send a password link to the user an email address is required.', 108);
}
$passwordEvent = new GenerateSecurePasswordEvent();
$this->eventDispatcher->dispatchTyped($passwordEvent);
$password = $passwordEvent->getPassword();
if ($password === null) {
// Fallback: ensure to pass password_policy in any case
$password = $this->secureRandom->generate(10)
. $this->secureRandom->generate(1, ISecureRandom::CHAR_UPPER)
. $this->secureRandom->generate(1, ISecureRandom::CHAR_LOWER)
. $this->secureRandom->generate(1, ISecureRandom::CHAR_DIGITS)
. $this->secureRandom->generate(1, ISecureRandom::CHAR_SYMBOLS);
}
$generatePasswordResetToken = true;
}

@joshtrichards joshtrichards added feature: users and groups feature: emails good first issue Small tasks with clear documentation about how and in which place you need to fix things in. labels Oct 20, 2023
@ezhil56x
Copy link
Member

I would like to work on this issue 🖐🏻. Can I get it assigned ?

@joshtrichards
Copy link
Member

@ezhil56x No assignment necessary. Feel free to do so.

ezhil56x added a commit that referenced this issue Oct 21, 2023
ezhil56x added a commit that referenced this issue Oct 21, 2023
ezhil56x added a commit that referenced this issue Oct 21, 2023
Signed-off-by: Ezhil Shanmugham <[email protected]>
@ezhil56x
Copy link
Member

@joshtrichards I have fixed this issue and created a PR on #41038 ⭐️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: emails feature: users and groups good first issue Small tasks with clear documentation about how and in which place you need to fix things in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants