http://www.dereuromark.de/2012/02/08/qlogin-quicklogins-fur-cakephp/
I use passwords that can be made valid for a single request, log the user in directly (either by link or by form)
Am Freitag, 30. November 2012 00:23:29 UTC+1 schrieb Reuben:
Hi FranklinIf the model that you authenticate against is the Person model, then you should be able to get away withpublic function index() {$this->set('people', $this->Auth->user();}
Since Auth->user() should return the whole model. Though you might want to double check with a bit of debug (DebugKit, or CakeLog::debug($this->Auth->user()) or errorLog(print_r($this->Auth-> user(), true)); Alternatively, there's:public function index() {$person = $this->Person->read(null, $this->Auth->user('id'));$this->set('people', $person);}
Once small niggle on readability. Setting 'people' implies that there are might be multiple people in the variable. If there's only ever going to be the one person, I would set('person') instead (i.e. $this->set(compact('person'));) , or put the $person into an array, so you can have a foreach in your index (i.e. $this->set('people', array($person)); )
RegardsReuben Helms
On Friday, 30 November 2012 08:10:59 UTC+10, Franklin Piercing wrote:Hi, this is what i´m trying to do, i have this index.ctp view where i show some information about the logged user (such as name, mail, etc).. but in the Users table there´s a field called info that the user can update, the thing is that, in my index fuction in my Users´s controller i have this
public function index() {
$this->Person->id = $this->Session->read('Auth.User.id ');
$this->set('people', $this->Person->read());
}
it shows the info perfect, so, in my index view i have a little section with a textfield where the user can update this "info" field, so the thing is that i'm trying to create this form in an element and include it into my index view, i have my controller's action called update_info with the logic to do so.. but it doesn´t works, i don´t know why, anybody canhelp me with this or maybe give me ideas about other ways to do it???
thanx a lot!
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment