Hi All!

I am really  having a problem in login form. I followed everything but
still can't solve this problem.

Here's the my code.

security.yml

security:
    encoders:
        MyBundle\Entity\User: sha1

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN,
ROLE_ALLOWED_TO_SWITCH]

    providers:
        main:
            entity: { class: CiteMedia\CashForGoldBundle\Entity\User,
property: username }

    firewalls:
        profiler:
            pattern:  ^/_profiler
            security: false

        wdt:
            pattern:  ^/_wdt
            security: false

        login:
            pattern:  ^/login$
            security: false

        secured_area:
            pattern:    ^/
            anonymous: false
            form_login:
                check_path: /login_check
                login_path: /login
                always_use_default_target_path: true
                default_target_path: /admin/dashboard

            logout:
                path:   /logout
                target: /login

    access_control:
        - { path: /admin, roles: ROLE_ADMIN }
        - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }



routing.yml

_login:
    pattern:  /login
    defaults: { _controller: MyBundle:Default:login }

_login_check:
    pattern:  /login_check

_logout:
    pattern:  /logout




class DefaultController extends Controller
{
    public function loginAction()
    {

                if ($this->get('request')->attributes-
>has(SecurityContext::AUTHENTICATION_ERROR)) {
            $error = $this->get('request')->attributes-
>get(SecurityContext::AUTHENTICATION_ERROR);
        } else {
            $error = $this->get('request')->getSession()-
>get(SecurityContext::AUTHENTICATION_ERROR);
        }

        if ($error) {
            // TODO: this is a potential security risk (see
http://trac.symfony-project.org/ticket/9523)
            $error = $error->getMessage();
        }

                return $this->render('MyBundle:Default:login.html.twig', array(
                                'last_username' => 
$this->get('request')->getSession()-
>get(SecurityContext::LAST_USERNAME),
                                'error'                 => $error
                        )
                );
    }
}


Everytime I logged-in using the correct credentials I always this
error
"Item message for The presented password is invalid. does not exist in
MyBundle:login.html.twig at line 9".

It seems that it doesn't validating my password.

Hope you could help me out with this.

Thanks in advance.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to