コード例 #1
0
 public function linkData($link)
 {
     $results = array();
     $contents = \ipinga\crypto::printableDecrypt($link);
     if (is_array($contents) == true) {
         $linkUserId = $contents['u'];
         $linkTime = (double) $contents['t'];
         $t = \ipinga\options::get('password_link_timeout');
         if (empty($t) == true) {
             $timeout = 10;
         } else {
             $timeout = (double) $t;
         }
         $now = (double) microtime(true);
         $elapsedMinutes = ($now - $linkTime) / 60;
         if ($elapsedMinutes > $timeout) {
             $results['error'] = 1;
             $results['message'] = 'Password reset link has expired';
         } else {
             $results['error'] = 0;
             $results['message'] = 'No error.  Link is good.';
             $u = new \ipinga\userTable('users');
             $u->loadById($linkUserId);
             $results['user'] = $u;
         }
     } else {
         $results['error'] = 2;
         $results['message'] = 'Password reset link is invalid';
     }
     return $results;
 }
コード例 #2
0
ファイル: cookie.class.php プロジェクト: vernsix/ipinga
 public static function decrypt($encryptedString)
 {
     $clearText = \ipinga\crypto::decrypt($encryptedString);
     $a = json_decode($clearText, true);
     return $a;
 }
コード例 #3
0
ファイル: crypto.class.php プロジェクト: vernsix/ipinga
 /**
  * @param string $encryptedString (created by printableEncrypt())
  *
  * @return array Decrypted original value
  */
 public static function printableDecrypt($encryptedString)
 {
     $a = json_decode(\ipinga\crypto::decrypt(hex2bin($encryptedString)), true);
     return $a['k'];
 }
コード例 #4
0
ファイル: table.class.php プロジェクト: vernsix/ipinga
 /**
  * Some other function prepares this and does all the binding.  All I am doing here is executing it in a common
  * fashion and populating all the fields() array
  *
  * @param \PDOStatement $stmt
  */
 protected function _process_loadby_execute($stmt)
 {
     try {
         $stmt->execute();
         $row = $stmt->fetch(\PDO::FETCH_ASSOC);
         foreach ($this->fieldTypes as $fieldName => $fieldType) {
             if ($fieldName == 'passwd') {
                 $this->field[$fieldName] = \ipinga\crypto::decrypt(hex2bin($row['passwd']));
             } else {
                 $this->field[$fieldName] = $row[$fieldName];
             }
         }
         if ($this->field['id'] < 1) {
             $this->saved = false;
         } else {
             $this->saved = true;
         }
     } catch (\Exception $e) {
         echo $e->getMessage() . '<br><hr>';
         $this->saved = false;
     }
 }