sfguard

How to catch an id from sfUser?

六月ゝ 毕业季﹏ 提交于 2020-01-11 10:48:07
问题 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. 回答1: if the user is authenticated, yes, you can use: // inside an action $id = $this->getUser()->getGuardUser()->getId(); // inside a template $id = $sf_user->getGuardUser(

Two tables relation with sfDoctrineGuard user table (symfony)

时光毁灭记忆、已成空白 提交于 2019-12-25 09:41:08
问题 Hy, I have started in my web application a part who users needs to be autenticated to work with it. I have two tables related: Customer and Enterprise.... the first one are users who want to buy a product and the second one are "users" who want to sell products. What is better way to do that? Relation 1:1 with user_table? how can i differentiate wich one user type is? Because user types only can edit some information and enterprise have acces to another modules... Thanks a lot. 回答1: You could

Auto-generate field value on sfGuardUser when registering

大憨熊 提交于 2019-12-14 02:26:39
问题 I'm building a Symfony 1.4 project that is using sfDoctrineGuardPlugin for users/authentication. I have a field on my user table named "access_token" that I would like to populate with an auto-generated value upon user registration. I see that for registration, the sfGuardRegisterForm is used for validation. Unfortunately, when I run ./symfony doctrine:build-forms from the command line, this form doesn't appear to be extended, meaning that I can't generate an access token there without

How to add users to sfguard

前提是你 提交于 2019-12-12 10:58:50
问题 I'm using symfony 1.2 with sfguard 1.4.1. What's the best practice for registering a new user on the system? 回答1: It's: symfony guard:create-user <username> <password> 回答2: You can use sfDoctrineApply. This plugin generates the necessary templates for creating and validating users in the frontend. It can also send emails to users to validated accounts. It's necessary to install ZendMail. 来源: https://stackoverflow.com/questions/906688/how-to-add-users-to-sfguard

Symfony sfGuardUser single authentication on several subdomains

爱⌒轻易说出口 提交于 2019-12-11 20:19:45
问题 I'm using symfony 1.4.20 with the sfGuardUser plugin. I have several subdomains that are sharing the same app. One module of the app should serve a slightly different content according the user is logged in or not. This module should be accessed through a subdomain, say sub.domain.com. Right now, if I access this module through domain.com, this works. If I access the modules through sub.domain.com, the user is seen as not logged in even if he is. My guess is the auth cookie used by the sfguad

sfGuard custom algorithm_callable

主宰稳场 提交于 2019-12-11 17:36:44
问题 I am trying to make custom algorithm for password hashing. I try to do this. In app.cfg: sf_guard_plugin: algorithm_callable: [Hlp, noHash] In apps/frontend/lib/Hlp.php: class Hlp { function noHash($password) //tried to make public or public static, but it didn't work either { return $password; } } And in my database 'algorithm' is set to 'noHash'. When I try to log in I get following error: The algorithm callable "noHash" is not callable. I am using php 5.2. What am I doing wrong? UPDATE

Removing table headers from embedRelation()

半世苍凉 提交于 2019-12-11 11:07:22
问题 I have used the embedRelation() to pull another form into the sfGuard user form. It is working correctly, I am just trying to style it to fit into the current form. This pulls the form in: $this->embedRelation('Profile'); but it is adding some extra html elements that I would like to remove: <div class="form_row"> Profile <table> <tbody><tr> <th><label for="sf_guard_user_Profile_department_title">Department</label></th> <td><input type="text" name="sf_guard_user[Profile][department_title]"

Adding a new user field to sfGuard user Admin Form

匆匆过客 提交于 2019-12-11 10:49:10
问题 I am trying to add a custom field to the user form in the sfGuard plugin. I have created the column in the database and added the widgetschema for the field. It is showing up correctly in the form, and when text is added and submitted, it is showing the update was successful. The data inserted into the field is not getting populated in the database though. I am thinking I have to update the model for sfGuard, as it is not aware of the new field. I have tried $ ./symfony doctrine:build-model ,

Backend sfGuardUser module

爷,独闯天下 提交于 2019-12-08 11:22:45
问题 I use symfony 1.4.11 with Doctrine I have sfGuardUser module in backend. I have sfGuardUserProfile table. sfGuardUserProfile: connection: doctrine tableName: sf_guard_user_profile columns: id: { type: integer(4), primary: true, autoincrement: true } user_id: { type: integer(4), notnull: true } salutation: { type: string(10), notnull: true } first_name: { type: string(30), notnull: true } last_name: { type: string(30), notnull: true } country: { type: string(255), notnull: true } postcode: {

auth problems (security filters) in sfGuardUser Symfony

巧了我就是萌 提交于 2019-12-08 08:10:20
问题 I'm using Symfony 1.2.7, and sfGuardUser Plugin. I'm able to view all the pages, login and logout. However when I try to edit (just going to the form) or update an object (saving the changes) sometimes I have problems of auth, and symfony redirects me to the edit form page again. I put some emphasys on sometimes because it's what it's driving me crazy :) Users have cookies and the remember_cookie. I'm using the cookie domain ".domain.com" for both cookies because we work with subdomains. On