doctrine2 - Symfony authentication (by tutorial) bad credentials -


here app/logs/dev.log:

[2013-05-19 13:29:42] doctrine.debug: set names utf8 [] [] [2013-05-19 13:29:42] doctrine.debug: select t0.id id1, t0.username username2, t0.salt salt3, t0.password password4, t0.email email5, t0.is_active is_active6 user t0 t0.username = ? limit 1 ["administrator"] [] [2013-05-19 13:29:42] security.info: authentication request failed: bad credentials [] [] 

here fixture created , loaded db:

class fixtureloader implements fixtureinterface {      public function load(objectmanager $manager) {            $role = new role();           $role->setname('Администратор');           $role->setrole('role_admin');            $manager->persist($role);            $user = new user();           $user->setusername('administrator');           $user->setemail('admin@umahanov.com');           $user->setsalt(md5(time()));           $user->setisactive(false);            $encoder = new messagedigestpasswordencoder('sha512',true,10);           $password = $encoder->encodepassword('111111', $user->getsalt());           $user->setpassword($password);           $user->getuserroles()->add($role);           $manager->persist($user);            $manager->flush();         } } 

my security.yml

security:     encoders:       umahanov\userbundle\entity\user:                 algorithm: sha512         encode-as-base64: true         iterations: 10     providers:       main:         entity: { class: umahanovuserbundle:user, property: username}            firewalls:         insecure:             pattern:  ^/(_(profiler|wdt)|css|images|js)/             security: false         secure_area:             pattern:    ^/             form_login:                 login_path:  /user/login                 check_path:  /user/login_check             logout:                 path:   /user/logout                 target: /                anonymous: ~     role_hierarchy:         role_admin:       role_user     access_control:         - { path: ^/admin, role: role_admin}               - { path: ^/.*, role: is_authenticated_anonymously }    

i have simple entities - user , role manytomany relation

my form:

{% extends '::layout.html.twig' %} {% block content %} {% if error %} <div> {{ error.message }}</div> {% endif %} <form action="{{ path('user_check_path')}}" method="post" novalidate="">      <label for="username">username:</label>      <input type="text" id="username" name="_username" value="{{ last_username }}" />      <label for="password">password:</label>      <input type="password" id="password" name="_password" />          <button type="submit">войти</button> </form> <p><a href="{{ path('user_register') }}">sign here</a></p> {% endblock %} 

don't know why shows bad credentials. can please explain me, why there no password comparison in doctrine.debug query?

the problem in length of password field (varchar(40))

sha512 produces string 88 symbols length


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -