# "Forgotten Password" functionality for front-end users

**URL:** <https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095>\
**Category:** Questions\
**Created:** [November 29, 2021, 10:20am UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095 "2021-11-29T10:20:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [November 29, 2021, 10:20am UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/1 "2021-11-29T10:20:48Z")

</div>

Hi,  
I have a site with a front-end login system, using Kirby’s users system via Uniform ([GitHub - mzur/kirby-uniform: A versatile Kirby plugin to handle web form actions.](https://github.com/mzur/kirby-uniform)). All working great.

I now need to add a “Forgotten Password” process for the users, in case they forget their details. I know there is a panel-based system but I need to do this for users without panel access.

I am not sure where to start with this, would anyone be able to give any pointers for implementing this? Thanks in advance!

Mike

---

<div class="post-metadata">

**Author:** ![moonwalk](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@moonwalk](https://forum.getkirby.com/u/moonwalk)\
**Post date:** [November 29, 2021, 10:34am UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/2 "2021-11-29T10:34:30Z")

</div>

I think you can use the password reset form also for users without Panel access.

> **[Password reset form](https://getkirby.com/docs/guide/authentication/password-reset-form)**
>
> Kirby comes with a simple form to reset your password that you can also use yourself.

---

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [November 29, 2021, 4:17pm UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/3 "2021-11-29T16:17:07Z")

</div>

Hi,  
No that doesn’t work unfortunately.  
The _ideal_ flow I would be after would be a page for forgotten password, where the visitor enters their email address. This would then trigger an email with a URL in to the user to reset the password. At that URL would be a form for them to enter a new password for that account (still on my site front end).

I guess I need some sort of authentication in the URL that is sent… this is a bit beyond my experience but hopefully someone here has implemented something like it for a Kirby members site.

---

<div class="post-metadata">

**Author:** ![mickaeldurand](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mickaeldurand/32/8022_2.png) [@mickaeldurand](https://forum.getkirby.com/u/mickaeldurand)\
**Post date:** [June 10, 2022, 12:44pm UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/4 "2022-06-10T12:44:29Z")

</div>

hello, did you find a solution? To be able to reset the front side password?

---

<div class="post-metadata">

**Author:** ![ErVal](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@ErVal](https://forum.getkirby.com/u/ErVal)\
**Post date:** [June 10, 2022, 3:13pm UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/5 "2022-06-10T15:13:05Z")

</div>

If you don’t want the user to put in a code as authentication before resetting the password you can do so via a URL and a specific template for the reset page.

for example you could have smth like this in your controller for the passwort reset page:

```auto
if ($kirby->request()->is('POST') && get('pwresetstart')){
  $authCode = md5(uniqid("", true).random_bytes(20));
  
  $confirmlink = $site->url()."/pw-reset/{$authCode}/";
  
  $kirby->impersonate('kirby');
  
  $site->find('pw-reset')->createChild([
    'template' => 'confirm',
    'slug' => $authCode,
    'draft' => false
  ]);
  
  $body = "{$site->find('pw-reset')->mailbody()->value()}\n\n";
  
  // like this you could use %link as a variable within a textarea for example, and replace that part with the URL for the password reset
  $body = str_replace("%link", $confirmlink, $body);
      
  kirby()->email([
    "to" => get('email'),
    "from" => "{$page->noreplymail()->value()}",
    "subject" => "{$page->pwresetsubject()->value()}",
    "body" => $body
  ]);

}

```

Generally you could try and make use of controllers for this if the kirby-given password reset is insufficient for you.

> **[Controllers](https://getkirby.com/docs/reference/plugins/extensions/controllers)**

---

<div class="post-metadata">

**Author:** ![mickaeldurand](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mickaeldurand/32/8022_2.png) [@mickaeldurand](https://forum.getkirby.com/u/mickaeldurand)\
**Post date:** [June 22, 2022, 3:28pm UTC](https://forum.getkirby.com/t/forgotten-password-functionality-for-front-end-users/24095/6 "2022-06-22T15:28:14Z")

</div>

@ErVal I will try what you suggest.

Do you have the template part?
