dpxkkhu1812 2017-02-15 12:11
浏览 51
已采纳

用户名和密码在尝试登录时不正确 - symfony

I have created a little symfony app that handles signin and signout. Everything seems perfect but when I try to sign in to the app it keeps telling username/password not correct. This is my attempt

In the parameters.yml file I have this for the database connection

database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: null
    database_name: loginDb
    database_user: root
    database_password: null

I am using this in my UserController to check if username and password is correct

 if ($form->isValid()) {
........                    

                        $session->set("user", $user);

                        return $this->redirect($this->generateUrl("project_homepage"));
                    } else {
                        $session->getFlashBag()->add(
                                'message', "Username or password is incorrect."
                        );
                    }
                }

I am trying to login from the front end with the username and password as I have in my database but its not granting me access. This looks weird to me. What could be wrong. Thanks for assistance received

  • 写回答

1条回答 默认 最新

  • dougou1127 2017-02-15 12:59
    关注

    My best guess is the password you are passing into the query is wrong.

    Depending on how you set up your users, the encrypted password is not just sha1. If you use the symfony security, then the password would be set for the query using the encoder

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么