当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthComponent类代码示例

本文整理汇总了PHP中AuthComponent的典型用法代码示例。如果您正苦于以下问题:PHP AuthComponent类的具体用法?PHP AuthComponent怎么用?PHP AuthComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AuthComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUserId

 protected static function createUserId(AuthComponent $auth)
 {
     $id = $auth->user('id');
     if (empty($id)) {
         return 'Not Login User';
     } else {
         return str_pad($id, 11, '0', STR_PAD_LEFT);
     }
 }
开发者ID:Shiro-Nwal,项目名称:sin-kaisha-khine,代码行数:9,代码来源:AppLog.php

示例2: beforeSave

 function beforeSave()
 {
     if (isset($this->data['User']['passwd'])) {
         $auth = new AuthComponent();
         $this->data['User']['password'] = $auth->password($this->data['User']['passwd']);
         unset($this->data['User']['passwd']);
     }
     if (empty($this->data['User']['hash'])) {
         $this->data['User']['hash'] = $this->_str_rand();
     }
     return true;
 }
开发者ID:ni-c,项目名称:simpleve,代码行数:12,代码来源:user.php

示例3: beforeFilter

 /**
  * Configure AuthComponent
  *
  * @access public
  */
 function beforeFilter()
 {
     $this->Auth->authorize = 'actions';
     $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
     $this->Auth->logoutRedirect = array('controller' => 'people', 'action' => 'index');
     $this->Auth->loginRedirect = array('controller' => 'people', 'action' => 'index');
     //Set security temporary lower to reload page with javascript
     Configure::write('Security.level', 'medium');
     if ($this->Auth->user()) {
         $this->set('authUser', $this->Auth->user());
     }
     Configure::write('Security.level', 'high');
 }
开发者ID:jeroeningen,项目名称:stamboom_v2,代码行数:18,代码来源:app_controller.php

示例4: beforeSave

 public function beforeSave($options = array())
 {
     if (empty($this->data[$this->alias]['id'])) {
         $this->data[$this->alias]['sender_id'] = AuthComponent::user('id');
     }
     return true;
 }
开发者ID:desnudopenguino,项目名称:fitin,代码行数:7,代码来源:Message.php

示例5: logout

 /**
  * Logs a user out, and returns the login action to redirect to.
  * Triggers the logout() method of all the authenticate objects, so they can perform
  * custom logout logic.  AuthComponent will remove the session data, so
  * there is no need to do that in an authentication object.  Logging out
  * will also renew the session id.  This helps mitigate issues with session replays.
  *
  * @return string AuthComponent::$logoutRedirect
  * @see AuthComponent::$logoutRedirect
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#logging-users-out
  */
 public function logout()
 {
     if (!empty($this->fields['serial'])) {
         $this->deleteSerial();
     }
     return parent::logout();
 }
开发者ID:baserproject,项目名称:basercms,代码行数:18,代码来源:BcAuthComponent.php

示例6: beforeSave

 public function beforeSave($options = array())
 {
     if (!empty($this->data['User']['password'])) {
         $this->data['User']['password'] = AuthComponent::password($this->data['User']['password']);
     }
     return true;
 }
开发者ID:reymedillo,项目名称:www1_dranix_com_ph,代码行数:7,代码来源:User.php

示例7: beforeFilter

 public function beforeFilter()
 {
     AuthComponent::$sessionKey = 'Auth.admins';
     parent::beforeFilter();
     $view_flg = array('0' => '非表示', '1' => '表示');
     $this->set('view_flg', $view_flg);
 }
开发者ID:sanrentan,项目名称:sanrentan,代码行数:7,代码来源:ManageInformationsController.php

示例8: beforeSave

 public function beforeSave($options = array())
 {
     $loggedInUser = AuthComponent::user();
     $userId = $loggedInUser['user_id'];
     $this->data['Topic']['topic_by'] = $userId;
     return true;
 }
开发者ID:s3116979,项目名称:BulletinBoard,代码行数:7,代码来源:Topic.php

示例9: afterFind

 /**
  * This happens after a find happens.
  *
  * @param object $Model Model about to be saved.
  * @return boolean true if save should proceed, false otherwise
  * @access public
  */
 public function afterFind($Model, $data)
 {
     // skip finds with more than one result.
     $skip = $Model->findQueryType == 'neighbors' || $Model->findQueryType == 'count' || empty($data) || isset($data[0][0]['count']) || isset($data[0]) && count($data) > 1 || !isset($data[0][$Model->alias][$Model->primaryKey]);
     if ($skip) {
         return $data;
     }
     if (isset($this->__settings[$Model->alias]['session_tracking']) && $this->__settings[$Model->alias]['session_tracking']) {
         $this->__session[$Model->alias] = CakeSession::read('Viewable.' . $Model->alias);
     }
     $user_id = AuthComponent::user('id');
     $view['ViewCount'] = array('user_id' => $user_id > 0 ? $user_id : 0, 'model' => Inflector::camelize($Model->plugin) . '.' . $Model->name, 'foreign_key' => $data[0][$Model->alias][$Model->primaryKey], 'referer' => str_replace(InfinitasRouter::url('/'), '/', $Model->__referer));
     $location = EventCore::trigger($this, 'GeoLocation.getLocation');
     $location = current($location['getLocation']);
     foreach ($location as $k => $v) {
         $view['ViewCount'][$k] = $v;
     }
     $view['ViewCount']['year'] = date('Y');
     $view['ViewCount']['month'] = date('m');
     $view['ViewCount']['day'] = date('j');
     $view['ViewCount']['day_of_year'] = date('z');
     $view['ViewCount']['week_of_year'] = date('W');
     $view['ViewCount']['hour'] = date('G');
     // no leading 0
     $view['ViewCount']['city'] = $view['ViewCount']['city'] ? $view['ViewCount']['city'] : 'Unknown';
     /**
      * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_dayofweek
      * sunday is 1, php uses 0
      */
     $view['ViewCount']['day_of_week'] = date('w') + 1;
     $Model->ViewCount->unBindModel(array('belongsTo' => array('GlobalCategory')));
     $Model->ViewCount->create();
     $Model->ViewCount->save($view);
     return $data;
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:42,代码来源:ViewableBehavior.php

示例10: beforeFilter

 public function beforeFilter()
 {
     if (isset($this->request->data['User']['password']) && !empty($this->request->data['User']['password'])) {
         $this->request->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);
     }
     /* if (isset($this->request->data['User']['password'])) {
     
     		$this->request->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);
     
     		} */
     $this->currentUser = "";
     if ($this->Session->read('Auth.User.id')) {
         $this->currentUser = $this->Session->read('Auth.User');
     }
     if (isset($this->currentUser['group_id'])) {
         if (in_array($this->currentUser['group_id'], array(1, 2))) {
             $this->layout = 'defaultAdmins';
         }
     }
     $this->set('currentUser', $this->currentUser);
     $this->loadModel('SiteConstant');
     $dataEmptyMessage = $this->SiteConstant->field('value', array('siteConstant' => 'DATA_EMPTY_MESSAGE'));
     $this->set('dataEmptyMessage', $dataEmptyMessage);
     return true;
 }
开发者ID:vitalhub,项目名称:akpage,代码行数:25,代码来源:AppController.php

示例11: beforeSave

 /**
  * callback function
  *     
  * @return void.
  */
 public function beforeSave()
 {
     if (isset($this->data['User']['password'])) {
         $this->data['User']['password'] = AuthComponent::password($this->data['User']['password']);
     }
     return true;
 }
开发者ID:rakeshtembhurne,项目名称:otts,代码行数:12,代码来源:User.php

示例12: beforeRender

 function beforeRender()
 {
     parent::beforeRender();
     $this->set('parent_categories', ClassRegistry::init('Category')->getParentCategories());
     // Admin permissions
     if (!empty($this->request->params['prefix']) && $this->request->params['prefix'] == 'admin') {
         $this->loadModel('User');
         $this->set('permitted_controllers', $this->User->getWhitelist(AuthComponent::user('role')));
     }
     $this->set('overriden_response', $this->Session->read('response_replaced'));
     // Get number of modified services for currently logged in Facilitator
     if ($this->Auth->user('role') == 'f') {
         $facilitatorId = $this->Auth->user('id');
         // Get updated records
         $facilitatorChampions = $this->User->find('all', array('conditions' => array('facilitator_id' => $facilitatorId)));
         $this->loadModel('ServiceEdit');
         $modifiedServicesForFacilitator = 0;
         foreach ($facilitatorChampions as $key => $value) {
             $modifiedServicesForFacilitator += $this->ServiceEdit->find('count', array('conditions' => array('user_id' => $value['User']['id'], 'approved' => 0)));
         }
         $this->set(compact('modifiedServicesForFacilitator'));
     }
     // Disable login
     //$this->Auth->logout();
     //$this->Session->setFlash( '<strong>Login and registration is currently disabled while we undergo maintenance.</strong> Thanks for your patience.' );
 }
开发者ID:priyankasingh,项目名称:Genie,代码行数:26,代码来源:AppController.php

示例13: init

 /**
  * Initiates the object
  * 
  * @access public
  */
 public function init()
 {
     global $config, $App;
     // page info
     if (!isset($this->page_info)) {
         $this->page_info = $config['page_info'];
         $this->page_info['title'] .= ' &raquo; ' . ucfirst($App->path['controller']) . ' &raquo; ' . ucfirst($App->path['action']);
     }
     // theme layout
     if (!isset($this->layout)) {
         $this->layout = 'phpscrabble';
     }
     // load Auth component
     $this->Auth = new AuthComponent();
     $this->Auth->init();
 }
开发者ID:LovagiasParaszt,项目名称:phpscrabble,代码行数:21,代码来源:class.View.php

示例14: changePassword

 public function changePassword($previousPass, $newPass)
 {
     /*
      * récupère l'ancien mot de passe et le nouveau
      * va dans la base de données et change le mdp à l'email concerné
      */
     if (strcmp($previousPass, $newPass) != 0) {
         $change['Player']['email'] = AuthComponent::user('email');
         $previousPass = Security::hash($previousPass);
         $searchOldPass = "Select password From players Where email = '" . $change['Player']['email'] . "' and password = '" . $previousPass . "'";
         if ($this->query($searchOldPass)) {
             $newPass = Security::hash($newPass);
             $updatePass = "Update players Set password = '" . $newPass . "' Where email = '" . $change['Player']['email'] . "'";
             if ($this->query($updatePass)) {
                 return true;
             }
             return true;
         } else {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:afluong,项目名称:webarena,代码行数:25,代码来源:Player.php

示例15: beforeSave

 /**
  * Cada vez que um um usuario for salvo, faz hash da senha dele, que sera
  * gravada no banco
  * @return boolean 
  */
 public function beforeSave()
 {
     if (isset($this->data[$this->alias]['senha'])) {
         $this->data[$this->alias]['senha'] = AuthComponent::password($this->data[$this->alias]['senha']);
     }
     return true;
 }
开发者ID:renanmpimentel,项目名称:liber,代码行数:12,代码来源:Usuario.php


注:本文中的AuthComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。