Error "Statamic\Auth\Protect\Protectors\Password\Guard" not found #11546
Replies: 7 comments 1 reply
-
Can you provide the full stack trace? |
Beta Was this translation helpful? Give feedback.
-
What does your custom |
Beta Was this translation helpful? Give feedback.
-
Ahh, I've forgotten, that is was a custom tag. I found it on Discord from Jason: https://discord.com/channels/489818810157891584/1257350932170276914/1257436728768069632
|
Beta Was this translation helpful? Give feedback.
-
Looks like the I'll see if I can whip up an updated version for you. |
Beta Was this translation helpful? Give feedback.
-
This should work on the latest verison of Statamic: <?php
namespace App\Tags;
use Statamic\Auth\Protect\ProtectorManager;
use Statamic\Tags\Tags;
class HasEnteredPassword extends Tags
{
public function index()
{
$scheme = $this->params->get('scheme', 'password');
$password = session("statamic:protect:password.passwords.scheme.{$scheme}");
if (! $password) {
return false;
}
return app(ProtectorManager::class)
->driver($scheme)
->isValidPassword(session("statamic:protect:password.passwords.scheme.{$scheme}"));
}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks @duncanmcclean for your help, but I still have problem. When I use your tag, the result of the check is always false, even when I can see the protected sites. |
Beta Was this translation helpful? Give feedback.
-
Bug description
After updating from 5.23.0 to 5.49.1 this code
{{ if {has_entered_password} }}
causes this error:Class "Statamic\Auth\Protect\Protectors\Password\Guard" not found
After downgrading back the error is gone.
How to reproduce
I use a password secured area and checked with
{{ if {has_entered_password} }}
, if the user is logged in.Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Beta Was this translation helpful? Give feedback.
All reactions