Cakephp Auth reset/reload


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.