ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,44 @@
<?php
namespace LitExtension\CustomerPassword\Model;
class AccountManagement extends \Magento\Customer\Model\AccountManagement
{
protected function _beforeAuthenticate($email, $pass) {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$website_id = $objectManager->get('Magento\Store\Model\StoreManager')->getStore()->getWebsiteId();
$customer = $objectManager->create('Magento\Customer\Model\Customer')->setWebsiteId($website_id)->loadByEmail($email);
if(!$customer){
return False;
}
$iterator = new \DirectoryIterator(__DIR__ . '/Type');
foreach ($iterator as $fileInfo) {
if ($fileInfo->isDot() || $fileInfo->getExtension() != 'php') {
continue;
}
$className = "LitExtension\\CustomerPassword\\Model\\Type\\" . $fileInfo->getBasename('.php');
try{
$model = $objectManager->create($className);
if(!$model){
continue;
}
$check = $model->run($customer, $email, $pass);
if($check){
return True;
}
}catch (\Exception $e){
continue;
}
}
}
public function authenticate($username, $password) {
$this->_beforeAuthenticate($username, $password);
$customer = parent::authenticate($username, $password);
return $customer;
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model;
class Type
{
public function run($customerModel, $email, $password){
if($customer_id = $customerModel->getId()){
$pw_hash = $customerModel->getPasswordHash();
if(!$pw_hash){
return false;
}
try{
$check = $this->validatePassword($customerModel, $email, $password, $pw_hash);
}catch (\Exception $e){
return false;
}
if($check){
$hash = $customerModel->hashPassword((string)$password);
$customerModel->setPasswordHash($hash);
try{
$customerModel->save();
}catch (\Exception $e){
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$logger = $objectManager->create("\Psr\Log\LoggerInterface");
$logger->error($e->getMessage());
}
return true;
}
}
return false;
}
public function validatePassword($customerModel, $email, $password, $pw_hash){
return false;
}
}
@@ -0,0 +1,51 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Cart3d extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$data = array(
'email' => $username,
'password' => $password,
);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$configModel = $objectManager->create('Magento\Config\Model\Config');
$cart_url = $configModel->getConfigDataValue('lecupd/general/url');
$check = $this->_request($cart_url, $data);
return $check;
}
protected function _checkHeader($header) {
preg_match('/Location:(.+)/', $header, $match);
if ($match) {
if (!strpos($match[1], 'error')) {
return true;
}
}
return false;
}
protected function _request($url, $data = array()) {
$options = http_build_query($data);
$ch = curl_init($url . '/login.asp');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $options);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
if ($response && $this->_checkHeader($response)) {
return true;
}
return false;
}
}
@@ -0,0 +1,28 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Cscart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $string, $encrypted) {
$part = explode(" ", $encrypted);
$password = $part[0];
$salt = isset($part[1]) ? $part[1] : '';
if (empty($salt)) {
if (md5($string) == $password) {
return true;
}
} else {
if (md5(md5($string) . md5($salt)) == $password) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,38 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Cubecart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $string, $encrypted) {
$part = explode(":", $encrypted);
$md5 = $part[0];
$salt = isset($part[1]) ? $part[1] : '';
if (!empty($salt)) {
if (md5(md5($salt) . md5($string)) == $md5) {
return true;
} elseif (md5($this->sanitizeVar($string)) == $md5) {
return true;
} elseif (hash('whirlpool', $salt.$string.$salt) == $md5) {
return true;
}
} else {
if (md5($this->sanitizeVar($string)) == $md5) {
return true;
}
}
return false;
}
public function sanitizeVar($text) {
$text = htmlspecialchars($text, ENT_COMPAT);
return $text;
}
}
@@ -0,0 +1,107 @@
<?php
namespace LitExtension\CustomerPassword\Model\Type;
class Drupalcommerce extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
if (substr($pw_hash, 0, 2) == 'U$') {
$stored_hash = substr($pw_hash, 1);
$password = md5($password);
}
else {
$stored_hash = $pw_hash;
}
$type = substr($stored_hash, 0, 3);
switch ($type) {
case '$S$':
// A normal Drupal 7 password using sha512.
$hash = $this->_password_crypt('sha512', $password, $stored_hash);
break;
case '$H$':
// phpBB3 uses "$H$" for the same thing as "$P$".
case '$P$':
// A phpass password generated using md5. This is an
// imported password or from an earlier Drupal version.
$hash = $this->_password_crypt('md5', $password, $stored_hash);
break;
default:
return FALSE;
}
return ($hash && $stored_hash == $hash);
}
protected function _password_crypt($algo, $password, $setting) {
// Prevent DoS attacks by refusing to hash large passwords.
if (strlen($password) > 512) {
return FALSE;
}
// The first 12 characters of an existing hash are its setting string.
$setting = substr($setting, 0, 12);
if ($setting[0] != '$' || $setting[2] != '$') {
return FALSE;
}
$count_log2 = $this->_password_get_count_log2($setting);
// Hashes may be imported from elsewhere, so we allow != DRUPAL_HASH_COUNT
if ($count_log2 < 7 || $count_log2 > 30) {
return FALSE;
}
$salt = substr($setting, 4, 8);
// Hashes must have an 8 character salt.
if (strlen($salt) != 8) {
return FALSE;
}
// Convert the base 2 logarithm into an integer.
$count = 1 << $count_log2;
// We rely on the hash() function being available in PHP 5.2+.
$hash = hash($algo, $salt . $password, TRUE);
do {
$hash = hash($algo, $hash . $password, TRUE);
} while (--$count);
$len = strlen($hash);
$output = $setting . $this->_password_base64_encode($hash, $len);
// _password_base64_encode() of a 16 byte MD5 will always be 22 characters.
// _password_base64_encode() of a 64 byte sha512 will always be 86 characters.
$expected = 12 + ceil((8 * $len) / 6);
return (strlen($output) == $expected) ? substr($output, 0, 55) : FALSE;
}
protected function _password_get_count_log2($setting) {
$itoa64 = $this->_password_itoa64();
return strpos($itoa64, $setting[3]);
}
protected function _password_itoa64() {
return './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}
protected function _password_base64_encode($input, $count) {
$output = '';
$i = 0;
$itoa64 = $this->_password_itoa64();
do {
$value = ord($input[$i++]);
$output .= $itoa64[$value & 0x3f];
if ($i < $count) {
$value |= ord($input[$i]) << 8;
}
$output .= $itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count) {
break;
}
if ($i < $count) {
$value |= ord($input[$i]) << 16;
}
$output .= $itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count) {
break;
}
$output .= $itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
}
@@ -0,0 +1,28 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Interspire extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$part = explode(":", $pw_hash);
if(count($part) < 2 || !$part[0] || !$part[1]){
return false;
}
$pass_hash = $part[0];
$salt = $part[1];
$generate_pass = md5($salt.sha1($salt.$password));
$generate_pass = substr($generate_pass, 0, 50);
if($generate_pass == $pass_hash){
return true;
}
return false;
}
}
@@ -0,0 +1,26 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Loaded extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $encrypted) {
if (strstr($encrypted, '::')) { // sha256 hash
$stack = explode('::', $encrypted);
if (sizeof($stack) === 2) {
return ( hash('sha256', $stack[1] . $password) == $stack[0] );
}
} else { // legacy md5 hash - will be removed in production release
$stack = explode(':', $encrypted);
if (sizeof($stack) === 2) {
return ( md5($stack[1] . $password) == $stack[0] );
}
}
}
}
@@ -0,0 +1,54 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Magento extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customerModel, $email, $string, $encrypted) {
$hashArr = explode(':', $encrypted);
switch (count($hashArr)) {
case 1:
return $this->hash($string) === $encrypted;
case 2:
return $this->hash($hashArr[1] . $string) === $hashArr[0] || $this->hash256($hashArr[1] . $string) === $hashArr[0] || $this->getArgonHash($string, $hashArr[1]) === $hashArr[0];
}
return false;
}
public function hash($data)
{
return md5($data);
}
public function hash256($data)
{
return hash('sha256', $data);
}
public function getArgonHash($data, $salt = ''): string
{
$salt = empty($salt) ?
random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES) :
substr($salt, 0, SODIUM_CRYPTO_PWHASH_SALTBYTES);
if (strlen($salt) < SODIUM_CRYPTO_PWHASH_SALTBYTES) {
$salt = str_pad($salt, SODIUM_CRYPTO_PWHASH_SALTBYTES, $salt);
}
return bin2hex(
sodium_crypto_pwhash(
SODIUM_CRYPTO_SIGN_SEEDBYTES,
$data,
$salt,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE,
2
)
);
}
}
@@ -0,0 +1,312 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Mivamerchant extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
if(strpos($pw_hash, 'miva:') !== false){
$pw_hash = str_replace('miva:', '',$pw_hash);
$pw_hash = base64_decode($pw_hash);
return self::verify($password, $pw_hash);
}
return false;
}
static protected $salt_length = 8;
/**
* Create a unique salt string using the best source of random we can find
*
* @return string MIME base64
*/
public static function create_salt() {
$length = self::$salt_length;
$salt = '';
//mcrypt is our first choice
if (function_exists('mcrypt_create_iv')) {
$salt = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
if (strlen($salt) >= $length) {
return substr($salt, 0, $length);
}
}
//else let's try /dev/urandom (doesn't work with Windows)
if (is_readable('/dev/urandom') && ($fh = fopen('/dev/urandom', 'rb'))) {
$salt = fread($fh, $length);
fclose($fh);
if (strlen($salt) >= $length) {
return substr($salt, 0, $length);
}
}
//worst case scenario we'll use a binary md5 hash pasted together
$salt = '';
for ($i=0; $i<$length; $i+=16) { //16 is the length of a raw md5 hash
$salt .= md5(microtime(), true);
}
return substr($salt, 0, $length);
}
/**
* Create a Miva Merchant compatible password hash. Follows the following format:
* PBKDF:hash-algorithim:iterations:salt-base64:ciphertext-base64
*
* @see http://extranet.mivamerchant.com/forums/showthread.php?110099-Miva-Merchant-5-Production-Release-8-Update-7-Customer-Password-Encryption-Info
*
* @param string $password The plain-text password to hash
* @param string $salt The plain-text salt to use in the hash
* @param string $pbkdf_version The PBKDF version to use; PBKDF1 by default
* @param string $hash_algo The hashing algorithim to use; sha1 by default
* @param integer $iterations The number of times to run the hashing algorithim; 1000 by default
* @param integer $derived_key_length The maximum string length enforced on the derived key; 20 by default
* @return string A secure password hash string
*/
public static function create_hash($password, $salt='', $pbkdf_version='PBKDF1', $hash_algo='sha1', $iterations=1000, $derived_key_length=20) {
if ($salt === '') {
$salt = self::create_salt();
}
$pbkdf_version = strtoupper($pbkdf_version);
if (!in_array($pbkdf_version, array('PBKDF1', 'PBKDF2'))) {
throw new InvalidArgumentException($pbkdf_version . ' not supported');
}
switch ($pbkdf_version) {
case 'PBKDF1':
$derived_key = self::pbkdf1($password, $salt, $hash_algo, $iterations, $derived_key_length);
break;
case 'PBKDF2':
$derived_key = self::pbkdf2($password, $salt, $hash_algo, $iterations, $derived_key_length);
break;
//@Note: There are traces of a SHA1 hash function in the LSK (features/cus/cus_ut.mv), but it appears to be unused
}
if (!$derived_key) {
return false;
}
return strtoupper($pbkdf_version) . ':' . strtolower($hash_algo) . ':' . $iterations . ':' . base64_encode($salt) . ':' . base64_encode($derived_key);
}
/**
* Extract the algorithim details from the given hash such as:
* PBKDF version
* Hashing algorithim used
* Number of iterations used in hashing
* Salt
* Derived key
*
* @param string $hash A PBKDF hash; separated by colons
* @param string $option='' The key of the spcific detail you want returned
* @return mixed Returns an array unless an option param is passed.
*/
public static function extract_algorithim_info($good_hash, $option='') {
//make sure we have the proper formatted hash
$good_hash_infoArray = explode(':', $good_hash);
if (count($good_hash_infoArray) < 5) {
return;
}
list($pbkdf_version, $hash_algorithim, $iterations, $salt, $derived_key) = $good_hash_infoArray;
$salt = base64_decode($salt);
$derived_key = base64_decode($derived_key);
$algo_infoArray = array(
'PBKDF_version' => $pbkdf_version,
'hash_algorithim' => $hash_algorithim,
'iterations' => $iterations,
'salt' => $salt,
'derived_key' => $derived_key,
'derived_key_length' => strlen($derived_key),
);
if ($option !== '') {
if (isset($algo_infoArray[$option])) {
return $algo_infoArray[$option];
}
return;
}
return $algo_infoArray;
}
/**
* Generate a unique and secure password. This password will be returned as plain
* text and is NOT TO BE STORED ANYWHERE!
*
* @param int $pw_min_len The minimum length required for the new password.
* Quick note: Specifiying a minimum does not guarantee that the
* password will be exactly that length, it could be longer based on
* the $pw_complex parameter.
* @param int $pw_complex The password complexity level
* 0 = No requirements
* 1 = Requires a letter and either a digit or special character
* 2 = Requires an upper case letter, a lower case letter, and either a
* digit or special character
* @return string
*/
public static function generate($pw_min_len=6, $pw_complex=0) {
if ($pw_min_len < 6) $pw_min_len = 6;
if ($pw_complex < 0) $pw_complex = 0;
$uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$lowers = 'abcdefghijklmnopqrstuvwxyz';
$digits = '0123456789';
$others = '!@$%&*=';
$character_set = $uppers . $lowers . $digits . $others;
$has_upper = $has_lower = $has_digit = $has_other = false;
$password = '';
for ($i=0;$i<$pw_min_len;$i++) {
$char = $character_set[mt_rand(0, strlen($character_set)-1)];
$password .= $char;
if (strpos($uppers, $char) !== false) {
$has_upper = true;
} elseif (strpos($lowers, $char) !== false) {
$has_lower = true;
} elseif (strpos($digits, $char) !== false) {
$has_digit = true;
} elseif (strpos($others, $char) !== false) {
$has_other = true;
}
}
//check password requirements
switch ($pw_complex) {
case 0:
//no requirements
break;
case 1:
//require either an upper or lower and either a digit or other
if ($has_upper === false || $has_lower === false) {
$password = self::insertrandom($password, $uppers . $lowers);
}
if ($has_digit === false || $has_other === false) {
$password = self::insertrandom($password, $digits . $others);
}
break;
case 2:
//require an upper, lower, and either a digit or other
if ($has_upper === false) {
$password = self::insertrandom($password, $uppers);
}
if ($has_lower === false) {
$password = self::insertrandom($password, $lowers);
}
if ($has_digit === false || $has_other === false) {
$password = self::insertrandom($password, $digits . $others);
}
break;
}
return $password;
}
/**
* Verify that a given password matches the given password hash
*
* @param string $password The plain-text password to check
* @param string $good_hash The hash string we are checking against
* @return boolean True if the two strings contain the same password
*/
public static function verify($password, $good_hash) {
//first get all of the settings and details used in the creation of the good hash
$algorithim_infoArray = self::extract_algorithim_info($good_hash);
if (empty($algorithim_infoArray)) {
return false;
}
//generate a hash from the given password using the settings from good hash
$unknown_hash = self::create_hash($password, $algorithim_infoArray['salt'], $algorithim_infoArray['PBKDF_version'], $algorithim_infoArray['hash_algorithim'], $algorithim_infoArray['iterations'], $algorithim_infoArray['derived_key_length']);
return ($unknown_hash === $good_hash);
}
/**
* Insert a random character from the given character set in to the given password.
*
* @Note: This is a helper function for self::generate()
*
* @param string $password
* @param string $character_set
* @return string
*/
protected static function insertrandom($password, $character_set) {
$random_position = mt_rand(0, strlen($password)-1);
$random_char = $character_set[mt_rand(0, strlen($character_set)-1)];
return substr($password, 0, $random_position) . $random_char . substr($password, $random_position);
}
/**
* Standard implementation of PBKDF1
*
* @param string $password The plain-text password to hash
* @param string $salt The plain-text salt to use in the hash
* @param string $hash_algo MD2, MD5 or SHA1; SHA1 by default
* @param integer $iterations The number of iterations to run the hashing algorithim; 1000 by default
* @param integer $derived_key_length The maximum length of the resulting key; 20 by default
* @return string A PBKDF1 password hash string
*/
protected static function pbkdf1($password, $salt, $hash_algo, $iterations, $derived_key_length) {
$hash_algo = strtolower($hash_algo);
$iterations = (int)$iterations;
$derived_key_length = (int)$derived_key_length;
//supported hash algorithims
if (!in_array($hash_algo, array('md2', 'md5', 'sha1'))) {
throw new InvalidArgumentException($hash_algo . ' hash algorithim not supported');
}
//iterations and derived key length must be positive
if ($iterations <= 0) {
throw new InvalidArgumentException('Iterations must be a positive integer');
}
if ($derived_key_length <= 0) {
throw new InvalidArgumentException('Derived key must be a positive integer');
}
//derived key length is enforced for PBKDF1 based on hash algorithim
if ($hash_algo === 'md5' && $derived_key_length > 16) {
#throw new Exception('derived key too long');
return false;
}
if ($hash_algo === 'sha1' && $derived_key_length > 20) {
#throw new Exception('derived key too long');
return false;
}
//hash password and salt
$derived_key = $password . $salt;
for ($i=0; $i<$iterations; $i++) {
$derived_key = hash($hash_algo, $derived_key, true);
}
//truncate derived key based on given key length
$derived_key = substr($derived_key, 0, $derived_key_length);
return $derived_key;
}
/**
* Standard implementation of PBKDF2
*
* @param string $password The plain-text password to hash
* @param string $salt The plain-text salt to use in the hash
* @param string $hash_algo Hashing algorithim to use; SHA1 by default
* @param integer $iterations The number of iterations to run the hashing algorithim; 1000 by default
* @param integer $derived_key_length The maximum length of the resulting key; 20 by default
* @return string A PBKDF2 password hash string
*/
protected static function pbkdf2($password, $salt, $hash_algo, $iterations, $derived_key_length) {
$hash_algo = strtolower($hash_algo);
$iterations = (int)$iterations;
$derived_key_length = (int)$derived_key_length;
//supported hash algorithims
if (!in_array($hash_algo, hash_algos())) {
throw new InvalidArgumentException($hash_algo . ' hash algorithim not supported');
}
//iterations and derived key length must be positive
if ($iterations <= 0) {
throw new InvalidArgumentException('Iterations must be a positive integer');
}
if ($derived_key_length <= 0) {
throw new InvalidArgumentException('Derived key must be a positive integer');
}
//@Note: This is straight from https://defuse.ca/php-pbkdf2.htm
//get the hash string length of the algorithim being used
$hash_length = strlen(hash($hash_algo, '', true));
$block_count = ceil($derived_key_length / $hash_length);
$derived_key = '';
for ($i=1; $i<=$block_count; $i++) {
//$i encoded as 4 bytes, big endian.
$last = $salt . pack('N', $i);
//first iteration
$last = $xorsum = hash_hmac($hash_algo, $last, $password, true);
//perform the other $iterations - 1 iterations
for ($j=1; $j<$iterations; $j++) {
$xorsum ^= ($last = hash_hmac($hash_algo, $last, $password, true));
}
$derived_key .= $xorsum;
}
//truncate derived key based on given key length
$derived_key = substr($derived_key, 0, $derived_key_length);
return $derived_key;
}
}
@@ -0,0 +1,45 @@
<?php
namespace LitExtension\CustomerPassword\Model\Type;
class Nopcommerce extends \LitExtension\CustomerPassword\Model\Type
{
public function validatePassword($customerModel, $email, $string, $encrypted)
{
$check = false;
$hash = $this->convertHashToEncryptAndSalt($encrypted);
if(!$hash){
return $check;
}
$encrypt = $hash['encrypt'];
$salt = $hash['salt'];
$password_hash = $this->hashPassword($string, $salt);
return $encrypt == $password_hash;
}
public function hashPassword($password, $salt)
{
$concat = $password . $salt;
return strtoupper(sha1($concat));
}
public function convertHashToEncryptAndSalt($hash)
{
$split = explode(':', $hash);
$encrypt = isset($split[0]) ? $split[0] : false;
$salt = isset($split[1]) ? $split[1] : false;
if(!$encrypt || !$salt){
return false;
}
return array(
'encrypt' => $encrypt,
'salt' => $salt,
);
}
/**
* Password hash in db save with construct: Password:PasswordSalt
* Code hash password of nopCommerce in file: Libraries\Nop.Services\Security\EncryptionService.cs
*/
}
@@ -0,0 +1,31 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Opencart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customerModel, $email, $string, $encrypted) {
$part = explode(":", $encrypted);
$sha1 = $part[0];
$salt = isset($part[1]) ? $part[1] : '';
if (!empty($salt)) {
if (sha1($salt . sha1($salt . sha1($string))) == $sha1) {
return true;
} elseif (md5($string) == $sha1) {
return true;
}
} else {
if (md5($string) == $sha1) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,268 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Oscommerce extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$check = false;
$pass_type = $this->_tepPasswordType($pw_hash);
if($pass_type == 'salt'){
$check = $this->_tepValidateOldPassword($password, $pw_hash);
} else {
$hash = new OSCPasswordHash(10, true);
$check = $hash->CheckPassword($password, $pw_hash);
}
return $check;
}
protected function _tepPasswordType($encrypted) {
if (preg_match('/^[A-Z0-9]{32}\:[A-Z0-9]{2}$/i', $encrypted) === 1) {
return 'salt';
}
return 'phpass';
}
protected function _tepValidateOldPassword($plain, $encrypted) {
// split apart the hash / salt
$stack = explode(':', $encrypted);
if (sizeof($stack) != 2) return false;
if (md5($stack[1] . $plain) == $stack[0]) {
return true;
}
return false;
}
}
class OSCPasswordHash {
var $_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var $_iteration_count_log2;
var $_portable_hashes;
var $_random_state;
function PasswordHash($iteration_count_log2, $portable_hashes) {
$this->_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->_iteration_count_log2 = $iteration_count_log2;
$this->_portable_hashes = $portable_hashes;
$this->_random_state = microtime();
if (function_exists('getmypid'))
$this->_random_state .= getmypid();
}
function get_random_bytes($count) {
$output = '';
if (@is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
if (function_exists('stream_set_read_buffer')) {
stream_set_read_buffer($fh, 0);
}
$output = fread($fh, $count);
fclose($fh);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$output = openssl_random_pseudo_bytes($count, $orpb_secure);
if ($orpb_secure != true) {
$output = '';
}
} elseif (defined('MCRYPT_DEV_URANDOM')) {
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->_random_state = md5(microtime() . $this->_random_state);
$output .=
pack('H*', md5($this->_random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count) {
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->_itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->_itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->_itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->_itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input) {
$output = chr(36).chr(80).chr(36);
$output .= $this->_itoa64[min($this->_iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting) {
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id != chr(36).chr(80).chr(36) && $id != chr(36).chr(72).chr(36))
return $output;
$count_log2 = strpos($this->_itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_extended($input) {
$count_log2 = min($this->_iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 << $count_log2) - 1;
$output = '_';
$output .= $this->_itoa64[$count & 0x3f];
$output .= $this->_itoa64[($count >> 6) & 0x3f];
$output .= $this->_itoa64[($count >> 12) & 0x3f];
$output .= $this->_itoa64[($count >> 18) & 0x3f];
$output .= $this->encode64($input, 3);
return $output;
}
function gensalt_blowfish($input) {
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = chr(36).chr(50).chr(97).chr(36);
$output .= chr(ord('0') + $this->_iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->_iteration_count_log2 % 10);
$output .= chr(36);
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password) {
$random = '';
if (CRYPT_BLOWFISH == 1 && !$this->_portable_hashes) {
$random = $this->get_random_bytes(16);
$hash = crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 && !$this->_portable_hashes) {
if (strlen($random) < 3)
$random = $this->get_random_bytes(3);
$hash = crypt($password, $this->gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash = $this->crypt_private($password, $this->gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash) {
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
@@ -0,0 +1,29 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Oxideshop extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customerModel, $email, $string, $encrypted) {
///
$part = explode(":", $encrypted);
if(!$part[1]){
return false;
}
$password_hash = $part[0];
$hash = $part[1];
if($password_hash == hash('sha512', $string.$hash)){
return true;
}elseif($password_hash == md5($string . strval(@hex2bin($hash)))){
return true;
}
return false;
}
}
@@ -0,0 +1,268 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Pinnaclecart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$check = false;
$pass_type = $this->_tepPasswordType($pw_hash);
if($pass_type == 'salt'){
$check = $this->_tepValidateOldPassword($password, $pw_hash);
} else {
$hash = new PinnaclePasswordHash(10, true);
$check = $hash->CheckPassword($password, $pw_hash);
}
return $check;
}
protected function _tepPasswordType($encrypted) {
if (preg_match('/^[A-Z0-9]{32}\:[A-Z0-9]{2}$/i', $encrypted) === 1) {
return 'salt';
}
return 'phpass';
}
protected function _tepValidateOldPassword($plain, $encrypted) {
// split apart the hash / salt
$stack = explode(':', $encrypted);
if (sizeof($stack) != 2) return false;
if (md5($stack[1] . $plain) == $stack[0]) {
return true;
}
return false;
}
}
class PinnaclePasswordHash {
var $_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var $_iteration_count_log2;
var $_portable_hashes;
var $_random_state;
function PinnaclePasswordHash($iteration_count_log2, $portable_hashes) {
$this->_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->_iteration_count_log2 = $iteration_count_log2;
$this->_portable_hashes = $portable_hashes;
$this->_random_state = microtime();
if (function_exists('getmypid'))
$this->_random_state .= getmypid();
}
function get_random_bytes($count) {
$output = '';
if (@is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
if (function_exists('stream_set_read_buffer')) {
stream_set_read_buffer($fh, 0);
}
$output = fread($fh, $count);
fclose($fh);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$output = openssl_random_pseudo_bytes($count, $orpb_secure);
if ($orpb_secure != true) {
$output = '';
}
} elseif (defined('MCRYPT_DEV_URANDOM')) {
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->_random_state = md5(microtime() . $this->_random_state);
$output .=
pack('H*', md5($this->_random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count) {
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->_itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->_itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->_itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->_itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input) {
$output = chr(36).chr(80).chr(36);
$output .= $this->_itoa64[min($this->_iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting) {
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id != chr(36).chr(80).chr(36) && $id != chr(36).chr(72).chr(36))
return $output;
$count_log2 = strpos($this->_itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_extended($input) {
$count_log2 = min($this->_iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 << $count_log2) - 1;
$output = '_';
$output .= $this->_itoa64[$count & 0x3f];
$output .= $this->_itoa64[($count >> 6) & 0x3f];
$output .= $this->_itoa64[($count >> 12) & 0x3f];
$output .= $this->_itoa64[($count >> 18) & 0x3f];
$output .= $this->encode64($input, 3);
return $output;
}
function gensalt_blowfish($input) {
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = chr(36).chr(50).chr(97).chr(36);
$output .= chr(ord('0') + $this->_iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->_iteration_count_log2 % 10);
$output .= chr(36);
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password) {
$random = '';
if (CRYPT_BLOWFISH == 1 && !$this->_portable_hashes) {
$random = $this->get_random_bytes(16);
$hash = crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 && !$this->_portable_hashes) {
if (strlen($random) < 3)
$random = $this->get_random_bytes(3);
$hash = crypt($password, $this->gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash = $this->crypt_private($password, $this->gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash) {
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
@@ -0,0 +1,28 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Prestashop extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $string, $encrypted) {
$part = explode(":", $encrypted);
$pass = $part[0];
$cookie_key = isset($part[1]) ? $part[1] : '';
if(password_verify($string, $pass)) {
return true;
}
if (!$cookie_key) {
return false;
}
if (md5($cookie_key . $string) == $pass) {
return true;
}
return false;
}
}
@@ -0,0 +1,147 @@
<?php
namespace LitExtension\CustomerPassword\Model\Type;
class Shopware extends \LitExtension\CustomerPassword\Model\Type {
protected $encoder = [];
public function __construct() {
$this->encoder = array(
'md5' => 'Md5',
'sha256' => 'Sha256',
'bcrypt' => 'Bcrypt',
);
}
public function getEncoderByName($name)
{
$name = strtolower(trim($name));
if (!isset($this->encoder[$name])) {
return false;
}
if ($name == 'md5'){
return new Md5;
}
if ($name == 'sha256'){
return new Sha256;
}
if ($name == 'bcrypt'){
return new Bcrypt;
}
return false;
}
public function validatePassword($customerModel, $email, $password, $hash) {
$hashArr = explode(':', $hash);
if(count($hashArr) == 3){
$encoder = $this->getEncoderByName($hashArr[2]);
if(!$encoder){
return false;
}
return $encoder->isPasswordValid($password, $hashArr[0] . ':' . $hashArr[1]);
} elseif (count($hashArr) == 2){
$encoder = $this->getEncoderByName($hashArr[1]);
if(!$encoder){
return false;
}
return $encoder->isPasswordValid($password, $hashArr[0]);
}else{
$encoder = $this->getEncoderByName('md5');
if(!$encoder){
return false;
}
return $encoder->isPasswordValid($password, $hash);
}
}
}
interface PasswordEncoderInterface
{
/**
* @param string $password
* @param string $hash
*
* @return bool
*/
public function isPasswordValid($password, $hash);
}
class Sha256 implements PasswordEncoderInterface
{
/**
* @var array
*/
protected $options = [
'iterations' => 1000,
'salt_len' => 22,
];
/**
* @param string $password
* @param string $hash
*
* @return bool
*/
public function isPasswordValid($password, $hash)
{
list($iterations, $salt) = explode(':', $hash);
$verifyHash = $this->generateInternal($password, $salt, (int) $iterations);
return hash_equals($hash, $verifyHash);
}
/**
* @param string $password
* @param string $salt
* @param int $iterations
*
* @return string
*/
protected function generateInternal($password, $salt, $iterations)
{
$hash = '';
for ($i = 0; $i <= $iterations; ++$i) {
$hash = hash('sha256', $hash . $password . $salt);
}
return $iterations . ':' . $salt . ':' . $hash;
}
}
class Md5 implements PasswordEncoderInterface
{
/**
* @param string $password
* @param string $hash
*
* @return bool
*/
public function isPasswordValid($password, $hash)
{
if (strpos($hash, ':') === false) {
return hash_equals($hash, md5($password));
}
list($md5, $salt) = explode(':', $hash);
return hash_equals($md5, md5($password . $salt));
}
}
class Bcrypt implements PasswordEncoderInterface
{
/**
* @param string $password
* @param string $hash
*
* @return bool
*/
public function isPasswordValid($password, $hash)
{
return password_verify($password, $hash);
}
}
@@ -0,0 +1,107 @@
<?php
namespace LitExtension\CustomerPassword\Model\Type;
class Ubercart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
if (substr($pw_hash, 0, 2) == 'U$') {
$stored_hash = substr($pw_hash, 1);
$password = md5($password);
}
else {
$stored_hash = $pw_hash;
}
$type = substr($stored_hash, 0, 3);
switch ($type) {
case '$S$':
// A normal Drupal 7 password using sha512.
$hash = $this->_password_crypt('sha512', $password, $stored_hash);
break;
case '$H$':
// phpBB3 uses "$H$" for the same thing as "$P$".
case '$P$':
// A phpass password generated using md5. This is an
// imported password or from an earlier Drupal version.
$hash = $this->_password_crypt('md5', $password, $stored_hash);
break;
default:
return FALSE;
}
return ($hash && $stored_hash == $hash);
}
protected function _password_crypt($algo, $password, $setting) {
// Prevent DoS attacks by refusing to hash large passwords.
if (strlen($password) > 512) {
return FALSE;
}
// The first 12 characters of an existing hash are its setting string.
$setting = substr($setting, 0, 12);
if ($setting[0] != '$' || $setting[2] != '$') {
return FALSE;
}
$count_log2 = $this->_password_get_count_log2($setting);
// Hashes may be imported from elsewhere, so we allow != DRUPAL_HASH_COUNT
if ($count_log2 < 7 || $count_log2 > 30) {
return FALSE;
}
$salt = substr($setting, 4, 8);
// Hashes must have an 8 character salt.
if (strlen($salt) != 8) {
return FALSE;
}
// Convert the base 2 logarithm into an integer.
$count = 1 << $count_log2;
// We rely on the hash() function being available in PHP 5.2+.
$hash = hash($algo, $salt . $password, TRUE);
do {
$hash = hash($algo, $hash . $password, TRUE);
} while (--$count);
$len = strlen($hash);
$output = $setting . $this->_password_base64_encode($hash, $len);
// _password_base64_encode() of a 16 byte MD5 will always be 22 characters.
// _password_base64_encode() of a 64 byte sha512 will always be 86 characters.
$expected = 12 + ceil((8 * $len) / 6);
return (strlen($output) == $expected) ? substr($output, 0, 55) : FALSE;
}
protected function _password_get_count_log2($setting) {
$itoa64 = $this->_password_itoa64();
return strpos($itoa64, $setting[3]);
}
protected function _password_itoa64() {
return './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}
protected function _password_base64_encode($input, $count) {
$output = '';
$i = 0;
$itoa64 = $this->_password_itoa64();
do {
$value = ord($input[$i++]);
$output .= $itoa64[$value & 0x3f];
if ($i < $count) {
$value |= ord($input[$i]) << 8;
}
$output .= $itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count) {
break;
}
if ($i < $count) {
$value |= ord($input[$i]) << 16;
}
$output .= $itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count) {
break;
}
$output .= $itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
}
@@ -0,0 +1,174 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Virtuemart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$hash = new VmPasswordHash(10, true);
$check = $hash->verifyPassword($password, $pw_hash);
return $check;
}
}
class VmPasswordHash
{
var $_itoa64;
var $_iteration_count_log2;
var $_portable_hashes;
var $_random_state;
function VmPasswordHash($iteration_count_log2, $portable_hashes)
{
$this->_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->_iteration_count_log2 = $iteration_count_log2;
$this->_portable_hashes = $portable_hashes;
$this->_random_state = microtime();
if (function_exists('getmypid'))
$this->_random_state .= getmypid();
}
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id != chr(36).chr(80).chr(36) && $id != chr(36).chr(72).chr(36))
return $output;
$count_log2 = strpos($this->_itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function encode64($input, $count)
{
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->_itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->_itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->_itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->_itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function CheckPassword($password, $stored_hash)
{
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
public function verifyPassword($password, $hash, $user_id = 0)
{
$rehash = false;
$match = false;
// If we are using phpass
if (strpos($hash, chr(36).chr(80).chr(36)) === 0)
{
// Use PHPass's portable hashes with a cost of 10.
$phpass = new VmPasswordHash(10, true);
$match = $phpass->CheckPassword($password, $hash);
$rehash = false;
}
else
{
// Check the password
$parts = explode(':', $hash);
$crypt = $parts[0];
$salt = @$parts[1];
$rehash = true;
$testcrypt = md5($password . $salt) . ($salt ? ':' . $salt : '');
$match = $this->timingSafeCompare($hash, $testcrypt);
}
return $match;
}
public function timingSafeCompare($known, $unknown)
{
// Prevent issues if string length is 0
$known .= chr(0);
$unknown .= chr(0);
$knownLength = strlen($known);
$unknownLength = strlen($unknown);
// Set the result to the difference between the lengths
$result = $knownLength - $unknownLength;
// Note that we ALWAYS iterate over the user-supplied length to prevent leaking length info.
for ($i = 0; $i < $unknownLength; $i++)
{
// Using % here is a trick to prevent notices. It's safe, since if the lengths are different, $result is already non-0
$result |= (ord($known[$i % $knownLength]) ^ ord($unknown[$i]));
}
// They are only identical strings if $result is exactly 0...
return $result === 0;
}
}
@@ -0,0 +1,55 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Volusion extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$data = array(
'email' => $username,
'password' => $password,
'CustomerNewOld' => 'old'
);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$configModel = $objectManager->create('Magento\Config\Model\Config');
$cart_url = $configModel->getConfigDataValue('lecupd/general/url');
$check = $this->_request($cart_url, $data);
return $check;
}
protected function _checkHeader($header) {
preg_match('/Location:(.+)/', $header, $match);
if ($match) {
if (!strpos($match[1], 'shoppingcart.asp')) {
return true;
}
if(!strpos($match[1], 'myaccount.asp')){
return true;
}
}
return false;
}
protected function _request($url, $data = array()) {
$options = http_build_query($data);
$ch = curl_init($url . '/login.asp');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $options);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
if ($response && $this->_checkHeader($response)) {
return true;
}
return false;
}
}
@@ -0,0 +1,243 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Woocommerce extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$hash = new WooPasswordHash(10, true);
$check = $hash->CheckPassword($password, $pw_hash);
return $check;
}
}
class WooPasswordHash {
var $_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var $_iteration_count_log2;
var $_portable_hashes;
var $_random_state;
function PasswordHash($iteration_count_log2, $portable_hashes) {
$this->_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->_iteration_count_log2 = $iteration_count_log2;
$this->_portable_hashes = $portable_hashes;
$this->_random_state = microtime();
if (function_exists('getmypid'))
$this->_random_state .= getmypid();
}
function get_random_bytes($count) {
$output = '';
if (@is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
if (function_exists('stream_set_read_buffer')) {
stream_set_read_buffer($fh, 0);
}
$output = fread($fh, $count);
fclose($fh);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$output = openssl_random_pseudo_bytes($count, $orpb_secure);
if ($orpb_secure != true) {
$output = '';
}
} elseif (defined('MCRYPT_DEV_URANDOM')) {
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->_random_state = md5(microtime() . $this->_random_state);
$output .=
pack('H*', md5($this->_random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count) {
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->_itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->_itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->_itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->_itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input) {
$output = chr(36).chr(80).chr(36);
$output .= $this->_itoa64[min($this->_iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting) {
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id != chr(36).chr(80).chr(36) && $id != chr(36).chr(72).chr(36))
return $output;
$count_log2 = strpos($this->_itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_extended($input) {
$count_log2 = min($this->_iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 << $count_log2) - 1;
$output = '_';
$output .= $this->_itoa64[$count & 0x3f];
$output .= $this->_itoa64[($count >> 6) & 0x3f];
$output .= $this->_itoa64[($count >> 12) & 0x3f];
$output .= $this->_itoa64[($count >> 18) & 0x3f];
$output .= $this->encode64($input, 3);
return $output;
}
function gensalt_blowfish($input) {
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = chr(36).chr(50).chr(97).chr(36);
$output .= chr(ord('0') + $this->_iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->_iteration_count_log2 % 10);
$output .= chr(36);
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password) {
$random = '';
if (CRYPT_BLOWFISH == 1 && !$this->_portable_hashes) {
$random = $this->get_random_bytes(16);
$hash = crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 && !$this->_portable_hashes) {
if (strlen($random) < 3)
$random = $this->get_random_bytes(3);
$hash = crypt($password, $this->gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash = $this->crypt_private($password, $this->gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash) {
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
@@ -0,0 +1,243 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Wpecommerce extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$hash = new WpPasswordHash(10, true);
$check = $hash->CheckPassword($password, $pw_hash);
return $check;
}
}
class WpPasswordHash {
var $_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var $_iteration_count_log2;
var $_portable_hashes;
var $_random_state;
function PasswordHash($iteration_count_log2, $portable_hashes) {
$this->_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->_iteration_count_log2 = $iteration_count_log2;
$this->_portable_hashes = $portable_hashes;
$this->_random_state = microtime();
if (function_exists('getmypid'))
$this->_random_state .= getmypid();
}
function get_random_bytes($count) {
$output = '';
if (@is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
if (function_exists('stream_set_read_buffer')) {
stream_set_read_buffer($fh, 0);
}
$output = fread($fh, $count);
fclose($fh);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$output = openssl_random_pseudo_bytes($count, $orpb_secure);
if ($orpb_secure != true) {
$output = '';
}
} elseif (defined('MCRYPT_DEV_URANDOM')) {
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->_random_state = md5(microtime() . $this->_random_state);
$output .=
pack('H*', md5($this->_random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count) {
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->_itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->_itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->_itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->_itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input) {
$output = chr(36).chr(80).chr(36);
$output .= $this->_itoa64[min($this->_iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting) {
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id != chr(36).chr(80).chr(36) && $id != chr(36).chr(72).chr(36))
return $output;
$count_log2 = strpos($this->_itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_extended($input) {
$count_log2 = min($this->_iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 << $count_log2) - 1;
$output = '_';
$output .= $this->_itoa64[$count & 0x3f];
$output .= $this->_itoa64[($count >> 6) & 0x3f];
$output .= $this->_itoa64[($count >> 12) & 0x3f];
$output .= $this->_itoa64[($count >> 18) & 0x3f];
$output .= $this->encode64($input, 3);
return $output;
}
function gensalt_blowfish($input) {
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = chr(36).chr(50).chr(97).chr(36);
$output .= chr(ord('0') + $this->_iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->_iteration_count_log2 % 10);
$output .= chr(36);
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password) {
$random = '';
if (CRYPT_BLOWFISH == 1 && !$this->_portable_hashes) {
$random = $this->get_random_bytes(16);
$hash = crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 && !$this->_portable_hashes) {
if (strlen($random) < 3)
$random = $this->get_random_bytes(3);
$hash = crypt($password, $this->gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash = $this->crypt_private($password, $this->gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash) {
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
@@ -0,0 +1,18 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Xtcommerce extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$check = ($pw_hash == md5($password));
return $check;
}
}
@@ -0,0 +1,129 @@
<?php
/**
* @project: CustomerPassword
* @author : LitExtension
* @url : http://litextension.com
* @email : litextension@gmail.com
*/
namespace LitExtension\CustomerPassword\Model\Type;
class Zencart extends \LitExtension\CustomerPassword\Model\Type {
public function validatePassword($customer, $username, $password, $pw_hash){
$hash = new zcPassword();
$check = $hash->CheckPassword($password, $pw_hash);
return $check;
}
}
class zcPassword
{
public function validatePassword($plain, $encrypted)
{
$type = $this->detectPasswordType($encrypted);
if ($type != 'unknown') {
$method = 'validatePassword' . ucfirst($type);
return $this->{$method}($plain, $encrypted);
}
$result = $this->password_verify($plain, $encrypted);
return $result;
}
/**
* validate a legacy md5 type password
*
* @param string $plain
* @param string $encrypted
* @return boolean
*/
public function validatePasswordOldMd5($plain, $encrypted)
{
if ($this->zen_not_null($plain) && $this->zen_not_null($encrypted)) {
$stack = explode(':', $encrypted);
if (sizeof($stack) != 2)
return false;
if (md5($stack [1] . $plain) == $stack [0]) {
return true;
}
}
return false;
}
/**
* validate a SHA256 type password
*
* @param string $plain
* @param string $encrypted
* @return boolean
*/
public function validatePasswordCompatSha256($plain, $encrypted)
{
if ($this->zen_not_null($plain) && $this->zen_not_null($encrypted)) {
$stack = explode(':', $encrypted);
if (sizeof($stack) != 2)
return false;
if (hash('sha256', $stack [1] . $plain) == $stack [0]) {
return true;
}
}
return false;
}
function zen_not_null($value) {
if (is_array($value)) {
if (sizeof($value) > 0) {
return true;
} else {
return false;
}
} else {
if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) {
return true;
} else {
return false;
}
}
}
function detectPasswordType($encryptedPassword)
{
$type = 'unknown';
$tmp = explode(':', $encryptedPassword);
if (count($tmp) == 2) {
if (strlen($tmp [1]) > 2) {
$type = 'compatSha256';
} elseif (strlen($tmp [1]) == 2) {
$type = 'oldMd5';
}
}
return $type;
}
function password_verify($password, $hash) {
$ret = crypt($password, $hash);
if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13) {
return false;
}
$status = 0;
for ($i = 0; $i < strlen($ret); $i++) {
$status |= (ord($ret[$i]) ^ ord($hash[$i]));
}
return $status === 0;
}
function CheckPassword($password, $store_hash){
$check = $this->validatePassword($password, $store_hash);
if($check){
return $store_hash;
}
$salt = substr($store_hash, strrpos($store_hash,':')+1, 2);
$zc_password = md5($salt . $password) . ':' . $salt;
if($zc_password == $store_hash){
return $store_hash;
}
return false;
}
}
+12
View File
@@ -0,0 +1,12 @@
1. SETUP INSTRUCTIONS AND USAGE GUIDE
- Step 1: Access to Magento store by using FTP program and upload 'LitExtension' folder to your Magento /app/code folder. This will not overwrite any existing files, just upload the new folder to the folder root.
- Step 2: In SSH console of your server navigate to your store root folder
cd path_to_the_store_root_folder
run these commands:
php bin/magento module:enable LitExtension_CustomerPassword
php bin/magento setup:upgrade
2. CONTACT & SUPPORT & PLUGIN REQUEST
For any question, bug report, plugin request, please drop us a message with your details info at: http://litextension.com/contacts, or email us: contact@litextension.com
We are striving to get your issue solved within 24 hours.
+20
View File
@@ -0,0 +1,20 @@
{
"name": "litextension/module-customerpassword",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0"
},
"version": "1.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"LitExtension/CustomerPassword/": ""
}
}
}
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<lecupd>
<general>
<type></type>
<url></url>
</general>
</lecupd>
</default>
</config>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!--type name="Magento\Customer\Model\AccountManagement">
<plugin name="beforeAccountManage" type="LitExtension\CustomerPassword\Model\Plugin\AccountManagement" />
</type-->
<preference for="Magento\Customer\Model\AccountManagement" type="LitExtension\CustomerPassword\Model\AccountManagement" />
</config>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="LitExtension_CustomerPassword" setup_version="1.0.0">
</module>
</config>
+11
View File
@@ -0,0 +1,11 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'LitExtension_CustomerPassword',
__DIR__
);