Symfony sfGuardPlugin password recovery

倾然丶 夕夏残阳落幕 提交于 2019-12-07 09:56:26

Try logging into the server and changing into the Symfony project's root directory. There's probably a "symfony" script/link there (the details depend on your OS and how Symfony's set up; you might be able just to run ./symfony rather than needing php symfony). Run this to see whether this basics are working:

php symfony

If that works, you should get a list of possible tasks you can do. If you're using the sfGuardPlugin, you should see some tasks like guard:create-user.

To get more information on a task, try something like:

php symfony help guard:create-user

But basically, assuming a fairly modern Symfony installation and plugin, try something like:

php symfony guard:create-user --env=prod newusername newpassword

(the --env=prod option creates the user in the production environment, which is probably what you want.)

If there are super-user-only tasks you want to do, try also doing this:

php symfony guard:promote newusername

That will give the new user super-admin privileges.

You'll probably also find a guard:change-password task which will simply reset the password for a given user.

I ended up editing the file named:

plugins/sfGuardPlugin/lib/validator/sfGuardUserValidator.class.php

this is where the authentication takes place. I added a few lines to bypass the actual password check for an already created user.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!