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 在linux系统下vscode运行robocup3d上场球员报错
  • ¥15 Python语言实验
  • ¥15 SAP HANA SQL 增加合计行
  • ¥20 用C#语言解决一个英文打字练习器,有偿
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
  • ¥15 大一C语言期末考试,求帮助🙏🙏
  • ¥15 ch340驱动未分配COM
  • ¥15 Converting circular structure to JSON
  • ¥30 Hyper-v虚拟机相关问题,求解答。