Email template ‘login’ used instead of ‘password-reset’

I have created two email templates for the login code emails as per the docs (https://getkirby.com/docs/guide/authentication/login-methods#customize-email-text#customize-email-text).

When registering for the site, the template /site/templates/emails/auth/login.html.php is used for the login code email as expected.
When a user tries resetting their password, the same template is used, although /site/templates/emails/auth/password-reset.html.php exists, too.

What can I do for the correct template to be used?
Have I overlooked something?

(This is Kirby 4.1.0.)

Does this mean you have enabled both login by code and password-reset? That’s not possible.

Thank you for your swift reply, Sonja!

I was under the impression, that I need the code method for the registration process. Here’s the auth part from my config.php.

    'auth' => [
        'methods' => ['password', 'code'],
        'trials' => 999, // for testing only
        // 'debug' => true,
        'challenge' => [
            'timeout' => 5 * 60, // 5 minutes
            'email' => [
                'from'     => 'test@test.test',
                'fromName' => 'Test Test',
                'subject'  => 'Ihr Anmelde-Code'
            ]
        ],
    ],

The aim is, for the users to be able to register for the site, then receive a login code via email (double opt-in) and then setting a password to be able to log in with their credentials.
When they have forgotten their password, they should also be able to receive a login code to reset.

The login code emails being sent serve different purposes and thus should contain different wording.

Exactly, that is then the login code (because they can login via code and password). When login via code is enabled, they cannot also have a password-reset. The password-reset template is only used for password-resets. Where’s the point of sending them a different email if they can already login via code?

Thanks, Sonja.
I don’t understand, though. I guess, I have a different mental model of what “login via code” and “password-reset” mean, than what the docs requires it to be.
I will try different things—and to understand the difference in meaning from my mental model—and get back if necessary.

Login via code means the user enters their email, get a code sent to them, then they add this code in the form to log in.

Login via password means, the user enter their email and password to log in.

So say you now have enabled login via password and login via code

'auth' => [
    'methods' => ['password', 'code']
]

This means, the user can now choose how they want to log in. If they have forgotten their password, they can choose to log in via code instead, in which case they are sent a login code. Then, once they are logged in with this code, they can change their passwords. No need for an additional “I have forgotten my password, may I reset it”. And as I said, this is not supported by Kirby, anyway.

If you added password-reset to the list above

'methods' => ['password', 'code', 'password-reset']

you will get an error saying “The “code” and “password-reset” login methods cannot be enabled together”:

Thank you so much for you patient and thorough explanation, Sonja!

I was indeed looking at this the wrong way. I though, I had to add ‘code’ as an auth method in order for registration (with the login code) and password-reset to work.

Still, it is a little bit unsatisfying, that the two emails containing a login code in a password auth setup (the registration email and the password-reset email) cannot have different wording. We would have liked to dress the former as a welcome message and the latter more like “So you’ve forgotten your poor password…”. But we’ll be able to work around that.

Many thanks again!