Is there anyway to get direct access to the password reset page?
Currently you have to visit the login page and click ‘Forgot your password’ first. I’m just wanting to remove a step for the user.
I thought /panel/reset-password/
would go directly to it but that’s a different process.
Is that for a frontend login?
No for Panel access.
I’m sending an email to the new admin user via a hook when I’ve created their account.
Ideally wanted them to create a new password without having to send them one, hense the need for a link to the ‘forgot your password’ form/page.
A direct link to the password reset form is currently not available, but what you could do is to build a custom route like so (untested):
<?php
use Kirby\Http\Response;
return [
'routes' => [
[
'pattern' => 'reset-password/(:any)',
'action' => function ($email) {
try {
kirby()->auth()->createChallenge($email, false, 'password-reset');
} catch (\Exception $e) {
return new Response($e->getMessage(), 'text/plain', 400);
}
return Response::redirect('panel/login');
}
]
]
];
Then you can send users a link like https://example.com/reset-password/your@email.com
and they will be sent directly to the entry form for the password reset code.
1 Like