[英]Symfony 6 : Login impossible (nothing happens)
I hope you'll help me...我希望你能帮助我...
When I try to login on my Symfony 6 app, nothing happens.当我尝试登录我的 Symfony 6 应用程序时,没有任何反应。 I have no error, but it don't log me.
我没有错误,但它不记录我。 It only refresh the page.
它只会刷新页面。
security.yaml安全.yaml
security:
providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
security: false
lazy: true
provider: app_user_provider
custom_authenticator:
- App\Security\AppAuthenticator
logout:
path: app_logout
target: login
secured_area:
pattern: ^/
form_login:
login_path: app_login
check_path: app_login
SecurityController::login安全控制器::登录
public function login(AuthenticationUtils $authenticationUtils, $errorLog = null): Response
{
if ($this->getUser()) {
return $this->redirectToRoute('app_dashboard');
}
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
// var_dump($errorLog);
return $this->render('public/auth/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error
]);
}
My prod server is up to date and I can log me , but in dev (127.0.0.1) it's impossible.我的产品服务器是最新的,我可以登录,但在开发 (127.0.0.1) 中这是不可能的。
Thank you for your help.谢谢您的帮助。
Just try this:试试这个:
password_hashers:
App\Entity\User:
algorithm: auto
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: app_user_provider
It looks like you have disabled security layer in the main firewall.看起来您在主防火墙中禁用了安全层。 Try to remove
security: false
in the main firewall:尝试删除
security: false
在主防火墙中:
# security.yaml
security:
providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
# security: false # REMOVE THIS LINE
lazy: true
provider: app_user_provider
custom_authenticator:
- App\Security\AppAuthenticator
logout:
path: app_logout
target: login
secured_area:
pattern: ^/
form_login:
login_path: app_login
check_path: app_login
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.