<!-- Source: @site/projects/fortify-hardening-for-laravel/docs/07-configuration.md -->
<!-- Canonical: https://docs.pushery.com/fortify-hardening-for-laravel/configuration/ -->

# Configuration

> Every setting with its environment variable and its default, and the seven languages the answers and the notice are written in.

Every setting has a default, so the package works without a published configuration file. To
change a setting that has no environment variable, publish the file:

```bash
php artisan vendor:publish --tag=fortify-hardening-config
```

A published file keeps receiving settings that later releases add, because the package merges its
defaults under it key by key. A list you set, such as `notice_channels`, stands as you wrote it.

## Settings

| Key | Environment variable | Default | What it does |
|---|---|---|---|
| `password_reset_link.enabled` | `FORTIFY_HARDENING_PASSWORD_RESET_LINK` | `true` | answers every reset-link request like a sent link |
| `password_reset.enabled` | `FORTIFY_HARDENING_PASSWORD_RESET` | `true` | answers every failed reset like a wrong token |
| `registration.enabled` | `FORTIFY_HARDENING_REGISTRATION` | `true` | puts the neutral registration on Fortify's route |
| `registration.request` | | `RegistrationRequest::class` | the form request that validates a registration |
| `registration.redirect_route` | | `'login'` | where a web registration is redirected to |
| `registration.sign_in_route` | | `'login'` | where the notice's button leads |
| `registration.notification` | | `AccountAlreadyExistsNotification::class` | the notice the holder of a taken address receives |
| `registration.notice_channels` | | `['mail']` | the channels the notice goes out on |
| `registration.notice_mentions_password_reset` | | `true` | whether the notice says that a forgotten password can be reset |
| `registration.max_mails_per_hour` | `FORTIFY_HARDENING_MAX_MAILS_PER_HOUR` | `1` | how many mails the registration may send to one address within an hour |
| `timebox.microseconds` | `FORTIFY_HARDENING_TIMEBOX_MICROSECONDS` | `1000000` | the minimum duration of a failed sign-in, a reset-link request, a failed reset and a registration |
| `hashed_login_keys.enabled` | `FORTIFY_HARDENING_HASHED_LOGIN_KEYS` | `true` | counts failed sign-ins under a hashed key instead of the address and the IP |

A value the package cannot use falls back to its default: a mail budget below one is one, and a
minimum duration that is no whole number, such as `abc`, `0.5`, `.5` or `-3`, is the default. Only a
minimum of `0` leaves Laravel's own in place, and a value your application sets in
`auth.timebox_duration` always wins over the package's. See [Timing](https://docs.pushery.com/fortify-hardening-for-laravel/timing.md) for what the
minimum covers.

Each of the four `enabled` switches is off for `false`, `0`, `no` or `off` and on for `true`, `1`, `yes` or `on`,
in any case and with spaces around it. A variable that is not set or set to nothing, as copying a template of
a `.env` leaves one, keeps the section on, and so do `empty`, `(empty)`, `null` and `(null)`: each section is a
hardening, and an empty line doesn't drop it. Any other value stops the boot with an error that names the
variable, so a typo neither drops a section nor keeps one on unseen.

Switching off the registration takes the package's controller off Fortify's route, and so does a
username of its own, see [Registration](https://docs.pushery.com/fortify-hardening-for-laravel/registration.md#a-username-of-its-own). The
[registrar](https://docs.pushery.com/fortify-hardening-for-laravel/registration.md#from-a-controller-of-your-own) stays available to a controller of
your own.

## Translations

The answer to a registration and the notice are written in German, English, Spanish, French,
Italian, Dutch and Portuguese, in the application's locale. The answers on the password routes are
Laravel's own and come from your application's `passwords` translations.

A regional locale reads the catalog of its language: `pt-BR` and `pt-PT` read `pt`, `en-GB` reads
`en`, and so does a region nobody listed, such as `fr-CA` or `de_AT`. The Portuguese catalog is
written as in Portugal. A catalog you publish for the region under
`lang/vendor/fortify-hardening/pt-BR/` wins over the language key by key, so a Brazilian wording
needs only the keys that differ. This holds for the `fortify-hardening` namespace alone: your own
translations keep Laravel's lookup, which goes from the locale straight to `app.fallback_locale`.

| Key | English |
|---|---|
| `fortify-hardening::messages.registration.accepted` | We have sent an email to that address. Please check your inbox to continue. |
| `fortify-hardening::messages.notice.subject` | Someone tried to register at :app with your email address |
| `fortify-hardening::messages.notice.attempt` | Someone tried to create an account with this email address, but you already have one. |
| `fortify-hardening::messages.notice.action` | Sign in |
| `fortify-hardening::messages.notice.next` | If that was you and you have forgotten your password, you can reset it from the sign-in page. |
| `fortify-hardening::messages.notice.next_without_password` | If that was you, you can sign in from the sign-in page. |
| `fortify-hardening::messages.notice.not_you` | If it was not you, there is nothing you need to do. |

To change a text, or to add a language, publish the translations and edit them in
`lang/vendor/fortify-hardening`:

```bash
php artisan vendor:publish --tag=fortify-hardening-lang
```
