Posted By

resurge on 05/19/09


Tagged

auth cakephp reset reload


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hmvrulz


Cakephp Auth reset/reload


 / Published in: PHP
 

URL: http://groups.google.com/group/cake-php/browse_thread/thread/6b195757354e364c

  1. //app_controller.php
  2. /**
  3. * Refreshes the Auth to get new data
  4. * @param string $field
  5. * @param string $value
  6. * @return void
  7. */
  8. function _refreshAuth($field = '', $value = '') {
  9. if (!empty($field) && !empty($value)) {
  10. $this->Session->write($this->Auth->sessionKey .'.'. $field, $value);
  11. }else{
  12. if (isset($this->User)) {
  13. $this->Auth->login($this->User->read(false, $this->Auth->user('id')));
  14. }else{
  15. $this->Auth->login(ClassRegistry::init('User')->findById($this->Auth->user('id')));
  16. }
  17. }
  18. }

Report this snippet  

You need to login to post a comment.