sfDoctrineGuard and Forgot Password function

时光毁灭记忆、已成空白 提交于 2019-12-13 03:36:37

问题


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

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