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


PHP UserIdentity::encrypt_decrypt方法代码示例

本文整理汇总了PHP中UserIdentity::encrypt_decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP UserIdentity::encrypt_decrypt方法的具体用法?PHP UserIdentity::encrypt_decrypt怎么用?PHP UserIdentity::encrypt_decrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserIdentity的用法示例。


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

示例1: login

 /**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function login()
 {
     if ($this->_identity === null) {
         $this->_identity = new UserIdentity($this->username, $this->password);
         $this->_identity->authenticate();
     }
     if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
         $duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
         // 30 days
         Yii::app()->user->login($this->_identity, $duration);
         //SESSION HERE
         Yii::app()->session->add('username', UserIdentity::encrypt_decrypt('encrypt', $this->username));
         Yii::app()->session->add('password', UserIdentity::encrypt_decrypt('encrypt', $this->password));
         return true;
     } else {
         return false;
     }
 }
开发者ID:emircado,项目名称:pamgmt,代码行数:22,代码来源:LoginForm.php

示例2: __construct

 public function __construct($username = null, $password = null)
 {
     // bind and connect to the server
     if ($username == null || $password == null) {
         if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
             $username = UserIdentity::encrypt_decrypt('decrypt', Yii::app()->session['username']);
             $password = UserIdentity::encrypt_decrypt('decrypt', Yii::app()->session['password']);
         } else {
             throw new LDAPQueryException('Username and/or password missing');
         }
     }
     $options = Yii::app()->params['ldap'];
     $this->connection = ldap_connect($options['host']);
     ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3);
     ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
     ldap_start_tls($this->connection);
     if ($this->connection) {
         // Note: in general it is bad to hide errors, however we're checking for an error below
         $this->bind = @ldap_bind($this->connection, "uid={$username},ou={$options['ou']},{$options['base_dn']}", $password);
     }
 }
开发者ID:emircado,项目名称:pamgmt,代码行数:21,代码来源:LDAPQuery.php


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