Force Password Change at User Logon

I would like to be able to create a new user, then check a box to force them to change their password when they log in.


I guess this could be part of the password policy app we have, so I created an issue there:


Hi Nick, thanks for that!

Tell me, is this problem solved in version 15.0.5?

Create the user, including the email and set a random password.
Tell the user to use the forgot password feature and he will receive an email to change it :slight_smile:

how to do this in the “welcome email”? is it possible to edit the mail template?

In NC 15 you can add the email when you create the user, so you only have to add this line line in the welcome email:

Your username is USERNAME_HERE, use the forgot password to set your own password (and it’s advisable to enable security password enforcement in the server

If you are using an app that sends a welcome email in NC then I don’t know it

Hope this helps

and where can I edit the email template?

If you use the option resend welcome email it includes the name of your NC instance and the username.

I have never edited it, but probably it’s done in the file /nextcloud/settings/Mailer/NewUserMailHelper.php

I recommend you to backup it before modofying and do it in a testing environment :wink:

grafik :wink:

would be a nice new feature to be able to edit the templates.


1 Like

I have modified this line in the file file /nextcloud/settings/Mailer/NewUserMailHelper.php and it works like a charm, received email is OK. If you add $user or other parameters wrong you won’t have access to the users, but if you revert/restore the changes you can access again

FROM $emailTemplate->addBodyText($l10n->t(‘Welcome to your %s account, you can add, protect, and share your data.’, [$this->themingDefaults->getName()]));

TO $emailTemplate->addBodyText($l10n->t(‘Welcome to your %s account, you can add, protect, and share your data. Enter your username and click in forgot password to generate your password’, [$this->themingDefaults->getName()]));

That work around is ok for some but it really is a work around making you depend on a external account to be already setup a user properly . Alternatively It would be nice to have nextcloud be the first / only account for the user which then set an easy password that must change at first login with a good password policy it will allow you to put all other accounts (including email) in a password database thus keeping all accounts secured


As far as I know force password change has not been implemented yet.

When you create an account it’s a good practice to include the user email, so he can recover/reset password without intervention of the NC admin instance (unless you really want to have full control and do not allow your users to user forgot password or you don’t want to configure email notifications).

It would be nice to have this function implemented as you said :slight_smile:

If you add a new user without a pssword the user can set his password himself using the link in the mail… Maybe this helps?

At the moment don’t. Because in the login screen you need to insert a password.