Skip to content

AuthenticationService: Zero password problem #248

@atans

Description

@atans

User Entity:

/**
 * User
 *
 * @ORM\Entity
 * @ORM\Table(
 *     name="dbtuser",
 *     options={
 *         "collate"="utf8_general_ci"
 *     }
 * )
 */
class User
{
    /**
     * @ORM\Id
     * @ORM\Column(type="string", length=20)
     *
     * @var string
     */
    protected $userId;

    /**
     * @ORM\Column(type="string", length=20)
     *
     * @var string
     */
    protected $loginId;

    /**
     * @ORM\Column(type="string", length=20)
     *
     * @var string
     */
    protected $pw;

Login Action

    public function loginAction()
    {
        $request = $this->getRequest();

        $form = $this->getLoginForm();
        $error = null;
        if ($request->isPost()) {
            $form->setData($request->getPost());
            if ($form->isValid()) {
                $data = $form->getData();
                $authService = $this->getAuthenticationService();
                $adapter = $authService->getAdapter();
                $adapter->setIdentityValue($data['loginId']);
                $adapter->setCredentialValue($data['pw']);
                $authResult = $authService->authenticate();

                if ($result = $authResult->isValid()) {
                    var_dump($authResult->getMessages());
                } else {
                    var_dump($authResult->getMessages());
                }
            }
        }

        return array(
            'error' => $error,
            'form'  => $form,
        );
    }

sql

LoginId is admin and PW is 000000

Login Test:
1

2

3

Is this a bug?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions