Deploying Symfony2 app getting fosuserbundle errors

后端 未结 10 2086
北恋
北恋 2020-12-07 01:22

I have installed my Symfony project on another computer with the same specifications, and I receive the following error when I login with fosuserbundle:

Authe

相关标签:
10条回答
  • 2020-12-07 01:54

    Had the same issue while working in dev environment. I updated my User's model, and every time I tried to login I had your error. Solved by running:

    app/console cache:clear
    

    EDIT: Had the same issue again. This time it's happened because I moved my project to another server and forgot to update parameters.yml to match the server's MySQL credentials.

    0 讨论(0)
  • 2020-12-07 01:56

    I had the problem Symfony 2.3 and when I execute app/console doctrine:schema:update --dump-sql this is the result.

    DROP INDEX UNIQ_957A647992FC23A8 ON fos_user; DROP INDEX UNIQ_957A6479A0D96FBF ON fos_user; ALTER TABLE fos_user DROP username, DROP username_canonical, DROP email, DROP email_canonical, DROP enabled, DROP salt, DROP password, DROP last_login, DROP locked, DROP expired, DROP expires_at, DROP confirmation_token, DROP password_requested_at, DROP roles, DROP credentials_expired, DROP credentials_expire_at;

    It started working again just after I updated doctrine-bundle from 1.2 to 1.3.

    Info:

    https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2140

    0 讨论(0)
  • 2020-12-07 01:58

    It looks like that the error:

    Authentication request could not be processed due to a system problem.

    is too generic and does not tell anything about where the problem is (there is an issue opened about this matter here).

    I solved my issue by checking the logs and see what happened (in var/logs/dev.log), hoping this helps someone.

    In my specific case, there was a wrong parameter in parameters.yml about database.

    0 讨论(0)
  • 2020-12-07 01:59

    Make sure that your User entity implements the UserInterface

    <?php
    
    namespace UserBundle\Entity;
    
    use Doctrine\ORM\Mapping as ORM;
    use Symfony\Component\Security\Core\User\UserInterface;
    
    /**
     * BaseUser
     */
    class BaseUser implements UserInterface
    {
        /**
         * @var integer
         */
        protected $id;
    
        /**
         * @var string
         */
        protected $name;
    
        /**
         * @var string
         */
        protected $username;
    
        /**
         * @var string
         */
        protected $password;
    
        /**
         * @var string
         */ 
        protected $email;
    
        /**
         * @var string
         * 
         */
        protected $roles;
    
        /**
         * @var boolean
         */
        protected $isActive;
    
    
        /**
         * Get id
         *
         * @return integer 
         */
        public function getId()
        {
            return $this->id;
        }
    
        /**
         * Set name
         *
         * @param string $name
         * @return BaseUser
         */
        public function setName($name)
        {
            $this->name = $name;
    
            return $this;
        }
    
        /**
         * Get name
         *
         * @return string 
         */
        public function getName()
        {
            return $this->name;
        }
    
        /**
         * Set username
         *
         * @param string $username
         * @return BaseUser
         */
        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 BaseUser
         */
        public function setPassword($password)
        {
            if (!is_null($password)) {
                $this->password = $password;
            }
    
            return $this;
        }
    
        /**
         * Get password
         *
         * @return string 
         */
        public function getPassword()
        {
            return $this->password;
        }
    
        /**
         * Set email
         *
         * @param string $email
         * @return BaseUser
         */
        public function setEmail($email)
        {
            $this->email = $email;
    
            return $this;
        }
    
        /**
         * Get email
         *
         * @return string 
         */
        public function getEmail()
        {
            return $this->email;
        }
    
        /**
         * Set roles
         *
         * 
         * @return BaseUser
         */
        public function setRoles($roles)
        {
            $this->roles = $roles;
        }
    
        /**
         * Get roles
         */
        public function getRoles()
        {
            // Do what ever make sense to you here 
            return explode("|", $this->roles)
        }
    
        /**
         * Set isActive
         *
         * @param boolean $isActive
         * @return BaseUser
         */
        public function setIsActive($isActive)
        {
            $this->isActive = $isActive;
    
            return $this;
        }
    
        /**
         * Get isActive
         *
         * @return boolean 
         */
        public function getIsActive()
        {
            return $this->isActive;
        }
    
        public function eraseCredentials()
        {
        }
    
        public function getSalt()
        {
            return null;
        }
    }
    
    0 讨论(0)
提交回复
热议问题