用户未启用时返回自定义错误消息

时间:2021-02-24 14:59:17

标签: rest symfony authentication fosuserbundle

我一直在使用 Symfony(FosUsersBundle) 和 Angular 创建一个 web 应用程序,当用户输入错误的登录信息时,即使用户没有启用我总是同样的响应:

{code: 401, message: "Bad credentials"}

我想在用户未启用时重新调整消息“未启用”。

security.yml

      firewalls:
        api:
         pattern: ^/api
         stateless: true
         lexik_jwt:
            authorization_header:
                enabled: true
                prefix: Bearer
            query_parameter:
                enabled: true
                name: bearer
            throw_exceptions: false
            create_entry_point: true
         login:
            pattern: ^/login
            provider: fos_userbundle
            stateless: true
            form_login:
                check_path: /login_check
                username_parameter: username
                password_parameter: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
                require_previous_session: false 

提前致谢。

0 个答案:

没有答案
相关问题