PHPackages                             mouf/security.forgot-your-password - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mouf/security.forgot-your-password

ActiveMouf-library[Authentication &amp; Authorization](/categories/authentication)

mouf/security.forgot-your-password
==================================

A 'forgot your password' feature for Mouf security.

1.0.x-dev(8y ago)014.0k3[1 issues](https://github.com/thecodingmachine/security.forgot-your-password/issues)MITPHPPHP &gt;=7.0

Since Jan 8Pushed 8y ago7 watchersCompare

[ Source](https://github.com/thecodingmachine/security.forgot-your-password)[ Packagist](https://packagist.org/packages/mouf/security.forgot-your-password)[ Docs](http://mouf-php.com/packages/mouf/security.forgot-your-password)[ RSS](/packages/mouf-securityforgot-your-password/feed)WikiDiscussions 1.0 Synced 2mo ago

READMEChangelogDependencies (10)Versions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/e73d926b9ff3f482a1c7f00c9dce0b0605d50cce878bf92ad417173b4d5d270a/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f73656375726974792e666f72676f742d796f75722d70617373776f72642f762f737461626c65)](https://packagist.org/packages/mouf/security.forgot-your-password)[![Total Downloads](https://camo.githubusercontent.com/3f7c7d9bce06a8a2d83b40121713533adc0c4d6251bfdc165b805de1815c7b45/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f73656375726974792e666f72676f742d796f75722d70617373776f72642f646f776e6c6f616473)](https://packagist.org/packages/mouf/security.forgot-your-password)[![Latest Unstable Version](https://camo.githubusercontent.com/3ba8ed953d13b6f257f1bb5abcda31340fdaa6bda06b2c3b01186cdb251d2d37/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f73656375726974792e666f72676f742d796f75722d70617373776f72642f762f756e737461626c65)](https://packagist.org/packages/mouf/security.forgot-your-password)[![License](https://camo.githubusercontent.com/bba2a14efa8a912e7416f0f93dbe811c83908514cc019725fbb4e4fb8a050862/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f73656375726974792e666f72676f742d796f75722d70617373776f72642f6c6963656e7365)](https://packagist.org/packages/mouf/security.forgot-your-password)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6b9cbfc446f660a2de7fbb402eb3cf78477293d9f6cbeeef44a58c7d1c931d6a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746865636f64696e676d616368696e652f73656375726974792e666f72676f742d796f75722d70617373776f72642f6261646765732f7175616c6974792d73636f72652e706e673f623d312e30)](https://scrutinizer-ci.com/g/thecodingmachine/security.forgot-your-password/?branch=1.0)[![Build Status](https://camo.githubusercontent.com/5da0399de3cf5be9eef97e3a552eb5b8b46b2ce4e49e9248f923549f319e82be/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f73656375726974792e666f72676f742d796f75722d70617373776f72642e7376673f6272616e63683d312e30)](https://travis-ci.org/thecodingmachine/security.forgot-your-password)[![Coverage Status](https://camo.githubusercontent.com/b95288cd10b65305a93530d7631103e012101527a0d41ada748ef4c48de02388/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f746865636f64696e676d616368696e652f73656375726974792e666f72676f742d796f75722d70617373776f72642f62616467652e7376673f6272616e63683d312e3026736572766963653d676974687562)](https://coveralls.io/github/thecodingmachine/security.forgot-your-password?branch=1.0)

Forgot your password feature for Mouf
=====================================

[](#forgot-your-password-feature-for-mouf)

This package contains the controllers and services necessary to implement a "forgot your password" feature in Mouf.

Installation
============

[](#installation)

```
composer require mouf/security.forgot-your-password

```

Usage
=====

[](#usage)

Install the package using the Mouf installer.

This package **provides**:

- A controller (`ForgotYourPasswordController`): this controller provides the default `forgot/password` route that leads to the "I forgot my password" form. It also provides the `forgot/reset` route that is linked to in the mail. This route allows the user to reset its password.
- A service (`ForgotYourPasswordService`): this service is in charge of generating the unique token and sending the mail.

This package **does not contain** a way to access your database to store/retrieve tokens and associated users. For this, you need to provide a package implementing the [`ForgotYourPasswordDao` interface](http://mouf-php.com/packages/mouf/security.forgot-your-password-interface). For this, you might want to you an existing package already implementing it. If you are using TDBM, we recommend using [mouf/security.daos.tdbm](http://mouf-php.com/packages/mouf/security.daos.tdbm).

Customizing
===========

[](#customizing)

In this package, the views are based on the Bootstrap framework CSS. If your project uses another framework, you'll need to overwrite the views.

Customizing the "forgot your password" page
-------------------------------------------

[](#customizing-the-forgot-your-password-page)

The main "forgot your password" form is rendered using the `Mouf\Security\Password\ForgotYourPasswordView`. The Twig template is available in `vendor/mouf/security.forgot-your-password/src/templates/Mouf/Security/Password/ForgotYourPasswordView.twig`. To overwrite, copy this file to `src/templates/Mouf/Security/Password/ForgotYourPasswordView.twig` and purge your cache.

Customizing the "email sent" page
---------------------------------

[](#customizing-the-email-sent-page)

Once the "forgot your password" page is filled, the user arrives on the "email sent" page.

The page is rendered using the `Mouf\Security\Password\EmailSentView`. The Twig template is available in `vendor/mouf/security.forgot-your-password/src/templates/Mouf/Security/Password/EmailSentView.twig`. To overwrite, copy this file to `src/templates/Mouf/Security/Password/EmailSentView.twig` and purge your cache.

Customizing the email
---------------------

[](#customizing-the-email)

The email originates from a [`SwiftTwigMailTemplate`](https://github.com/thecodingmachine/swift-twig-mail-template).

If you want to customize this email, you can either:

- change the Twig template completely (by editing the |forgotYourPasswordMailTemplate`instance in the container and modifying the`twigPath` property to your own file)
- or you can simply overwrite the i18n strings by providing your own keys for the subject and the body:
    - `forgotyourpassword.mail.subject` is the subject
    - `forgotyourpassword.mail.body` is the body of the text

Customizing the "token not found" page
--------------------------------------

[](#customizing-the-token-not-found-page)

In case the user clicks on a URL link with a token that has already been used (or that is invalid), the "token not found" page is displayed.

The page is rendered using the `Mouf\Security\Password\TokenNotFoundView`. The Twig template is available in `vendor/mouf/security.forgot-your-password/src/templates/Mouf/Security/Password/TokenNotFoundView.twig`. To overwrite, copy this file to `src/templates/Mouf/Security/Password/TokenNotFoundView.twig` and purge your cache.

Customizing the "reset password" page
-------------------------------------

[](#customizing-the-reset-password-page)

When the user clicks on the link in the mail, he is redirected to the "reset password" page.

The page is rendered using the `Mouf\Security\Password\ResetPasswordView`. The Twig template is available in `vendor/mouf/security.forgot-your-password/src/templates/Mouf/Security/Password/ResetPasswordView.twig`. To overwrite, copy this file to `src/templates/Mouf/Security/Password/ResetPasswordView.twig` and purge your cache.

Customizing the "password reseted" page
---------------------------------------

[](#customizing-the-password-reseted-page)

This is the last page of the workflow, confirming the password was reset successfully.

The page is rendered using the `Mouf\Security\Password\ConfirmResetPasswordView`. The Twig template is available in `vendor/mouf/security.forgot-your-password/src/templates/Mouf/Security/Password/ConfirmResetPasswordView.twig`. To overwrite, copy this file to `src/templates/Mouf/Security/Password/ConfirmResetPasswordView.twig` and purge your cache.

Customizing password check strength
-----------------------------------

[](#customizing-password-check-strength)

By default when you reset your password, you will be asked a password that is:

- at least 7 characters long
- that contains at least one upper case letter
- that contains at least one lower case letter
- that contains at least one number

This can be completely configured in the `Mouf\Security\Password\PasswordStrengthCheck` instance.

Also, if you have very specific needs regarding password strength (for instance: at least 2 special characters, only japanese characters allowed, etc...), then you can simply provide your own service as long as it implements `Mouf\Security\Password\Api\PasswordStrengthCheck`.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3052d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (12 commits)")[![nguyenk](https://avatars.githubusercontent.com/u/2227554?v=4)](https://github.com/nguyenk "nguyenk (3 commits)")[![npeguin](https://avatars.githubusercontent.com/u/2227721?v=4)](https://github.com/npeguin "npeguin (1 commits)")[![soumayatcm](https://avatars.githubusercontent.com/u/34473656?v=4)](https://github.com/soumayatcm "soumayatcm (1 commits)")

---

Tags

passwordmouf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mouf-securityforgot-your-password/health.svg)

```
[![Health](https://phpackages.com/badges/mouf-securityforgot-your-password/health.svg)](https://phpackages.com/packages/mouf-securityforgot-your-password)
```

###  Alternatives

[paragonie/halite

High-level cryptography interface powered by libsodium

1.2k9.4M63](/packages/paragonie-halite)[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

791.2M17](/packages/kartik-v-yii2-password)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[phpnode/yiipassword

Password strategies for the Yii PHP framework.

75188.5k3](/packages/phpnode-yiipassword)[yebor974/filament-renew-password

Package for manage renew password according to the last renew or other criteria

4482.6k3](/packages/yebor974-filament-renew-password)[martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

3264.7k](/packages/martbock-laravel-diceware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
