问题
I'm pretty new to smyfony and I've been playing around with that sfDoctrineGuard plugin the whole day. it's working for the most part. I'm just having troubles with the forgot_password function.
Actually I did everything according to the readme file in the plugin.
the problem is:
in security.yml i set
default: is_secure:true
obviously in the module sfGuard there's a security.yml that sais:
secure: is_secure: false
signin: is_secure: false
signout: is_secure: false
which makes sense, cause otherwise the login site wouldn't be accessible.
BUT
it doesn't seem to work with the forgot_password function:
routing.yml
sf_guard_signin: url: /login param: { module: sfGuardAuth, action: signin }
sf_guard_signout: url: /logout param: { module: sfGuardAuth, action: signout }
sf_guard_forgot_password: url: /forgot_password param: { module: sfGuardForgotPassword, action: index }
sf_guard_forgot_password_change: url: /forgot_password/:unique_key class: sfDoctrineRoute options: { model: sfGuardForgotPassword, type: object } param: { module: sfGuardForgotPassword, action: change } requirements: sf_method: [get, post]
i cannot access /forgot_password as I am rerouted to the /login page. so i put a security.yml with
forgot_password: is_secure: false
in the config directory of the sfGuardForgotPassword module. But that doesn't seem to be working.
and it's not working if i put this in the global security.yml either :-(
Anybody got a clue?
回答1:
In /app/modules/sfGuardForgotPassword/config/security.yml
I have:
secure:
is_secure: true
index:
is_secure: false
change:
is_secure: false
In that app's routing.yml file I have:
sf_guard_signin:
url: /login
param: { module: sfGuardAuth, action: signin }
sf_guard_signout:
url: /logout
param: { module: sfGuardAuth, action: signout }
sf_guard_forgot_password:
url: /forgot_password
param: { module: sfGuardForgotPassword, action: index }
sf_guard_forgot_password_change:
url: /forgot_password/:unique_key
class: sfDoctrineRoute
options: { model: sfGuardForgotPassword, type: object }
param: { module: sfGuardForgotPassword, action: change }
requirements:
sf_method: [get, post]
回答2:
You can use sfForkedDoctrineApplyPlugin for this. Working good :)
回答3:
The forgot password feature was missing from the plugin. I wrote some changes to the code to add in the feature. I changed the password to reversible encryption so users can have their passwords emailed. Let me know if anyone wants to see code. We could fork a git repo and work on it together. It works.
来源:https://stackoverflow.com/questions/9068508/sfdoctrineguard-and-forgot-password-function