statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.03k stars 531 forks source link

The "password protected pages" - form page is not multisite compatible / localisable #10707

Closed AlexanderFalkenberg closed 1 month ago

AlexanderFalkenberg commented 2 months ago

Bug description

What happened

The password form page for localized (e.g. German) password-protected entries is not properly localized.

The Statamic\Auth\Protect\Protectors\Password is not aware of any source localization and is using Laravel's default locale, therefore default translations are used.

Expectation

I would expect to see a localized password form, if the protected page is localized / using a different language.

How to reproduce

  1. Create a multisite with Statamic.
  2. Localize an entry using a different language than the default app locale
  3. Protect the localized page using the password scheme.
  4. Visit the protected page

Logs

No response

Environment

Environment
Application Name: 
Laravel Version: 11.17.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: 
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Statamic
Addons: 6
Sites: 4  
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.17.0 PRO

Statamic Addons
aryehraber/statamic-color-extractor: 1.5.0
aryehraber/statamic-uuid: 2.3.0
ddm-studio/cookie-byte: 1.5.2
jonassiewertsen/statamic-documentation: 2.0.0
statamic-rad-pack/shopify: 3.4.0
swiftmade/statamic-clear-assets: 3.0.0

Installation

Existing Laravel app

Additional details

No response

duncanmcclean commented 2 months ago

Are you able to provide the contents of resources/sites.yaml?

AlexanderFalkenberg commented 2 months ago

I have the issue with different multisite projects (Statamic 4 & 5)

I set up an example project here: https://github.com/AlexanderFalkenberg/password-protect

sites.yaml

default: name: "{{ config:app:name }} [English]" url: / locale: en_US de: name: "{{ config:app:name }} [German]" url: "/de" locale: de_DE

duncanmcclean commented 2 months ago

Thanks!