Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [2017-01-16 22:57:51] request.INFO: Matched route "login". {"route":"login","route_parameters":{"_controller":"AppBundle\Controller\SecurityController::loginAction","_route":"login"},"request_uri":"http://localhost:8000/login","method":"GET"} []
- [2017-01-16 22:57:51] security.INFO: Populated the TokenStorage with an anonymous Token. [] [][2017-01-16 23:00:46] request.INFO: Matched route "login". {"route":"login","route_parameters":{"_controller":"AppBundle\Controller\SecurityController::loginAction","_route":"login"},"request_uri":"http://localhost:8000/login","method":"POST"} []
- [2017-01-16 23:00:46] security.INFO: Authentication request failed. {"exception":"[object] (Symfony\Component\Security\Core\Exception\BadCredentialsException(code: 0): Bad credentials. at /Users/mac/symfony-project/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php:73, Symfony\Component\Security\Core\Exception\UsernameNotFoundException(code: 0): Username "admin" does not exist. at /Users/mac/symfony-project/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php:109)"} []
- SecurityController.php on line 28:
- BadCredentialsException {#100 ▼
- -token: UsernamePasswordToken {#99 ▼
- -credentials: "abcdef"
- -providerKey: "main"
- -user: "admin"
- -roles: []
- -authenticated: false
- -attributes: []
- }
- #message: "Bad credentials."
- #code: 0
- #file: "../vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthentication ▶"
- #line: 73
- security:
- encoders:
- AppBundleEntityUser:
- algorithm: bcrypt
- cost: 12
- providers:
- in_memory:
- memory: ~
- user_provider:
- entity:
- class: AppBundleEntityUser
- property: username
- firewalls:
- main:
- anonymous: ~
- form_login:
- login_path: login
- check_path: login
- /**
- * @Route("/login", name="login")
- */
- public function loginAction(Request $request)
- {
- $form = $this->createForm(LoginType::class);
- $authenticationUtils = $this->get('security.authentication_utils');
- $a = 1;
- $a = 0;
- if ($a == 1)
- $error = $authenticationUtils->getLastAuthenticationError();
- else
- die(dump($authenticationUtils->getLastAuthenticationError()));
- $lastUsername = $authenticationUtils->getLastUsername();
- return $this->render('security/login.html.twig', array(
- 'form' => $form->createView(),
- 'last_username' => $lastUsername,
- 'error' => $error,
- ));
- }
- <form action="{{ path('login') }}" method="post">
- <label for="username">Username:</label>
- <input type="text" id="username" name="_username" />
- <label for="password">Password:</label>
- <input type="password" id="password" name="_password" />
- <button type="submit">login</button>
- </form>
- <?php
- namespace AppBundleEntity;
- use DoctrineORMMapping as ORM;
- use SymfonyComponentSecurityCoreUserUserInterface;
- use SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity;
- use SymfonyComponentValidatorConstraints as Assert;
- /**
- * User
- *
- * @ORMTable(name="user")
- * @ORMEntity(repositoryClass="AppBundleRepositoryUserRepository")
- * @UniqueEntity(fields="username", message="Username already taken")
- */
- class User implements UserInterface
- {
- /**
- * @var int
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- * @AssertNotBlank()
- * @ORMColumn(name="username", type="string", length=255, unique=true)
- */
- private $username;
- /**
- * @var string
- *
- * @ORMColumn(name="password", type="string", length=255)
- */
- private $password;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="created_at", type="datetime")
- */
- private $createdAt;
- /**
- * @AssertNotBlank()
- * @AssertLength(max=255)
- */
- private $plainPassword;
- public function __construct()
- {
- $this->createdAt = new DateTime();
- }
- /**
- * Get id
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set username
- *
- * @param string $username
- *
- * @return User
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * Get username
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Set password
- *
- * @param string $password
- *
- * @return User
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set createdAt
- *
- * @param DateTime $createdAt
- *
- * @return User
- */
- public function setCreatedAt($createdAt)
- {
- $this->createdAt = $createdAt;
- return $this;
- }
- /**
- * Get createdAt
- *
- * @return DateTime
- */
- public function getCreatedAt()
- {
- return $this->createdAt;
- }
- /**
- * Get plain password
- *
- * @return string
- */
- public function getPlainPassword()
- {
- return $this->plainPassword;
- }
- /**
- * Set plain password
- *
- * @param string $password
- *
- * @return Users
- */
- public function setPlainPassword($password)
- {
- $this->plainPassword = $password;
- return $this;
- }
- public function getRoles()
- {
- return array('ROLE_USER');
- }
- public function eraseCredentials()
- {
- }
- public function getSalt()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement