sfguard

How to catch an id from sfUser?

孤街醉人 提交于 2019-12-02 01:37:51
I'm working with symfony 1.4 & i use sfDoctrineGuardPlugin as a tool for authentifications. I want to catch the Id of user in order te store it in my table. After a small research, I guess I have to use that expression : getUser()->getGuardUser()->getId() . What i looking for is how to invest that expression for my target. Tom if the user is authenticated, yes, you can use: // inside an action $id = $this->getUser()->getGuardUser()->getId(); // inside a template $id = $sf_user->getGuardUser()->getId(); If the user is not authenticated, it'll throw an error. Depends from where you are calling.

Symfony 1.4: Custom error message for CSRF in forms

99封情书 提交于 2019-11-30 09:27:26
Can anyone tell me where/how to customise the CSRF token error message for forms in Symfony 1.4. I'm using sfDoctrineGuard for logins and in this form particularly, whenever a session runs out and you still have the page open, it throws a very user-unfriendly error: "CSRF attack detected". Something like "This session has expired. Please return to the home page and try again" sounds better. What's the right way to do this in the form class? Thanks. The only way seems to be to overwrite sfForm::addCSRFProtection() . In /lib/form/BaseForm.class.php you can add this piece of code: class BaseForm

Symfony 1.4: Custom error message for CSRF in forms

喜欢而已 提交于 2019-11-29 14:31:19
问题 Can anyone tell me where/how to customise the CSRF token error message for forms in Symfony 1.4. I'm using sfDoctrineGuard for logins and in this form particularly, whenever a session runs out and you still have the page open, it throws a very user-unfriendly error: "CSRF attack detected". Something like "This session has expired. Please return to the home page and try again" sounds better. What's the right way to do this in the form class? Thanks. 回答1: The only way seems to be to overwrite