Fixes
This commit is contained in:
parent
15a0c5cadb
commit
197b387006
@ -3,6 +3,8 @@ version: '3.7'
|
|||||||
services:
|
services:
|
||||||
php-fpm:
|
php-fpm:
|
||||||
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-fpm-${ENV?}:${TAG?}
|
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-fpm-${ENV?}:${TAG?}
|
||||||
|
environment:
|
||||||
|
- APP_ENV=prod
|
||||||
build:
|
build:
|
||||||
context: ../
|
context: ../
|
||||||
# platforms:
|
# platforms:
|
||||||
@ -15,6 +17,8 @@ services:
|
|||||||
- TARGET_PHP_VERSION=${PHP_VERSION?}
|
- TARGET_PHP_VERSION=${PHP_VERSION?}
|
||||||
php-cron:
|
php-cron:
|
||||||
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-cron-${ENV?}:${TAG?}
|
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-cron-${ENV?}:${TAG?}
|
||||||
|
environment:
|
||||||
|
- APP_ENV=prod
|
||||||
build:
|
build:
|
||||||
context: ../
|
context: ../
|
||||||
# platforms:
|
# platforms:
|
||||||
@ -28,6 +32,8 @@ services:
|
|||||||
|
|
||||||
web:
|
web:
|
||||||
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/web-${ENV?}:${TAG?}
|
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/web-${ENV?}:${TAG?}
|
||||||
|
environment:
|
||||||
|
- APP_ENV=prod
|
||||||
build:
|
build:
|
||||||
context: ../../
|
context: ../../
|
||||||
# platforms:
|
# platforms:
|
||||||
|
|||||||
@ -155,6 +155,8 @@ FROM base as prod
|
|||||||
|
|
||||||
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
|
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
|
||||||
|
|
||||||
|
ENV APP_ENV=prod
|
||||||
|
|
||||||
FROM base as ci
|
FROM base as ci
|
||||||
|
|
||||||
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
|
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
|
||||||
@ -169,3 +171,5 @@ RUN echo "root ALL=(ALL) NOPASSWD: ALL " | tee -a "/etc/sudoers.d/users" && \
|
|||||||
echo "${APP_USER_NAME} ALL=(ALL) NOPASSWD: ALL " | tee -a "/etc/sudoers.d/users"
|
echo "${APP_USER_NAME} ALL=(ALL) NOPASSWD: ALL " | tee -a "/etc/sudoers.d/users"
|
||||||
|
|
||||||
RUN pecl install xdebug
|
RUN pecl install xdebug
|
||||||
|
|
||||||
|
ENV APP_ENV=dev
|
||||||
|
|||||||
@ -5,5 +5,5 @@ BASH_ENV=/container.env
|
|||||||
* * * * * root chmod -R 0777 /data/www/old/market/steplayouter >> /var/log/cron.log 2>&1
|
* * * * * root chmod -R 0777 /data/www/old/market/steplayouter >> /var/log/cron.log 2>&1
|
||||||
* * * * * root chmod -R 0777 /data/www/new/web/uploads/media >> /var/log/cron.log 2>&1
|
* * * * * root chmod -R 0777 /data/www/new/web/uploads/media >> /var/log/cron.log 2>&1
|
||||||
* * * * * root chmod -R 0777 /data/www/new/web/media >> /var/log/cron.log 2>&1
|
* * * * * root chmod -R 0777 /data/www/new/web/media >> /var/log/cron.log 2>&1
|
||||||
* * * * * www-data cd /data/www/new/web && /usr/local/bin/php /data/www/new/bin/console --env=prod application:queue:do >> /var/log/cron.log 2>&1
|
* * * * * www-data cd /data/www/new/web && /usr/local/bin/php /data/www/new/bin/console application:queue:do >> /var/log/cron.log 2>&1
|
||||||
#
|
#
|
||||||
|
|||||||
@ -33,7 +33,7 @@ ifeq ($(ENV),prod)
|
|||||||
else ifeq ($(ENV),ci)
|
else ifeq ($(ENV),ci)
|
||||||
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_CI_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL_CI) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL)
|
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_CI_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL_CI) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL)
|
||||||
else ifeq ($(ENV),local)
|
else ifeq ($(ENV),local)
|
||||||
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_DEV) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL)
|
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL) -f $(DOCKER_COMPOSE_FILE_LOCAL_DEV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# We need a couple of environment variables for docker compose so we define a make variable that we can
|
# We need a couple of environment variables for docker compose so we define a make variable that we can
|
||||||
|
|||||||
@ -4,7 +4,7 @@ APP_SECRET=347829efiubvf347fbisdc27f
|
|||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
###> doctrine/doctrine-bundle ###
|
###> doctrine/doctrine-bundle ###
|
||||||
DATABASE_URL=mysql://psc:Wichtig1@mysql:3306/psc
|
DATABASE_URL=mysql://root:Wichtig1@mysql:3306/psc
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
|
|
||||||
###> doctrine/mongodb-odm-bundle ###
|
###> doctrine/mongodb-odm-bundle ###
|
||||||
|
|||||||
@ -31,7 +31,6 @@ use PSC\Shop\EntityBundle\Entity\ContactRole;
|
|||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
use PSC\Shop\EntityBundle\Entity\Product;
|
||||||
use PSC\Shop\EntityBundle\Entity\Role;
|
use PSC\Shop\EntityBundle\Entity\Role;
|
||||||
use PSC\Shop\EntityBundle\Entity\ShopContact;
|
use PSC\Shop\EntityBundle\Entity\ShopContact;
|
||||||
use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType;
|
|
||||||
use PSC\Shop\QueueBundle\Event\EventManager;
|
use PSC\Shop\QueueBundle\Event\EventManager;
|
||||||
use PSC\Shop\QueueBundle\Service\Event\Manager;
|
use PSC\Shop\QueueBundle\Service\Event\Manager;
|
||||||
use PSC\System\PluginBundle\Form\Chain\Field;
|
use PSC\System\PluginBundle\Form\Chain\Field;
|
||||||
|
|||||||
57
src/new/src/PSC/Shop/QueueBundle/Event/Contact/Login.php
Normal file
57
src/new/src/PSC/Shop/QueueBundle/Event/Contact/Login.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\QueueBundle\Event\Contact;
|
||||||
|
|
||||||
|
use PSC\Shop\QueueBundle\Event\Event;
|
||||||
|
use PSC\Shop\QueueBundle\Help\Shop;
|
||||||
|
|
||||||
|
class Login extends Event
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
protected $contact;
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return 'contact_login';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription()
|
||||||
|
{
|
||||||
|
return 'Kunde hat sich angemeldet';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getData()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'contact' => $this->contact
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setData($data)
|
||||||
|
{
|
||||||
|
$this->contact = $data['contact'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getContact()
|
||||||
|
{
|
||||||
|
return $this->contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $contact
|
||||||
|
*/
|
||||||
|
public function setContact($contact)
|
||||||
|
{
|
||||||
|
$this->contact = $contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHelp()
|
||||||
|
{
|
||||||
|
return [[
|
||||||
|
Shop::getColumn(),
|
||||||
|
\PSC\Shop\QueueBundle\Help\Contact::getColumn(),
|
||||||
|
]];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -75,6 +75,9 @@ services:
|
|||||||
PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Finish:
|
PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Finish:
|
||||||
tags:
|
tags:
|
||||||
- { name: events }
|
- { name: events }
|
||||||
|
PSC\Shop\QueueBundle\Event\Contact\Login:
|
||||||
|
tags:
|
||||||
|
- { name: events }
|
||||||
PSC\Shop\QueueBundle\Event\Contact\Create:
|
PSC\Shop\QueueBundle\Event\Contact\Create:
|
||||||
tags:
|
tags:
|
||||||
- { name: events }
|
- { name: events }
|
||||||
@ -114,4 +117,4 @@ services:
|
|||||||
|
|
||||||
PSC\Shop\QueueBundle\Service\Event\Registry:
|
PSC\Shop\QueueBundle\Service\Event\Registry:
|
||||||
tags:
|
tags:
|
||||||
- {name: autoregistry, tag: events }
|
- {name: autoregistry, tag: events }
|
||||||
|
|||||||
@ -312,7 +312,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create) {
|
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Login) {
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
@ -349,9 +349,17 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($html) {
|
if ($html) {
|
||||||
$message->html($html->render($params));
|
$message->html($html->render($params));
|
||||||
}
|
}
|
||||||
|
$this->_logService->createLogEntry($shop, new Contact(), LogEntry::INFO, PSCShopQueueBundle::class, $queue->getName(), "Login Mail send", [
|
||||||
|
'message' => $message->getTextBody(),
|
||||||
|
'from' => $from->render($params),
|
||||||
|
'to' => $to->render($params),
|
||||||
|
'subject' => $subject->render($params)
|
||||||
|
]);
|
||||||
$this->_mailer->send($message);
|
$this->_mailer->send($message);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$this->_logService->createLogEntry($shop, new Contact(), LogEntry::ERROR, PSCShopQueueBundle::class, $queue->getName(), "Login Mail error", [
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
]);
|
||||||
$this->_error = $e->getMessage();
|
$this->_error = $e->getMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType;
|
|||||||
use PSC\Shop\EntityBundle\Document\Queue;
|
use PSC\Shop\EntityBundle\Document\Queue;
|
||||||
use PSC\Shop\QueueBundle\Event\EventInterface;
|
use PSC\Shop\QueueBundle\Event\EventInterface;
|
||||||
use PSC\Shop\QueueBundle\Event\Order\Create;
|
use PSC\Shop\QueueBundle\Event\Order\Create;
|
||||||
|
use PSC\Shop\QueueBundle\Event\Contact\Login;
|
||||||
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
||||||
use PSC\System\PluginBundle\Event\EveryRun;
|
use PSC\System\PluginBundle\Event\EveryRun;
|
||||||
use PSC\System\SettingsBundle\Service\TemplateVars;
|
use PSC\System\SettingsBundle\Service\TemplateVars;
|
||||||
@ -137,6 +138,39 @@ class Url implements QueueInterface, ConfigurableElementInterface
|
|||||||
$messageString = $messageTemplate->render($templateVars->getTwigVars());
|
$messageString = $messageTemplate->render($templateVars->getTwigVars());
|
||||||
file_put_contents('/tmp/test.json', $messageString);
|
file_put_contents('/tmp/test.json', $messageString);
|
||||||
|
|
||||||
|
$res = $client->request(
|
||||||
|
'POST',
|
||||||
|
$urlString,
|
||||||
|
[
|
||||||
|
'headers' => [
|
||||||
|
'Accept' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => json_decode($messageString)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($event instanceof Login) {
|
||||||
|
$client = new Client();
|
||||||
|
$urlTemplate = $this->_template->createTemplate($doc->getUrl());
|
||||||
|
$messageTemplate = $this->_template->createTemplate($doc->getMessage());
|
||||||
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
|
/** @var Contact $contact */
|
||||||
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
|
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactObj */
|
||||||
|
$contactObj = $this->_doctrine_mongodb
|
||||||
|
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
||||||
|
->findOneBy(array('uid' => (string) $contact->getId()));
|
||||||
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
|
/** @var Shop $shop */
|
||||||
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
|
$params = array(
|
||||||
|
'contact' => $contact,
|
||||||
|
'contactDoc' => $contactObj,
|
||||||
|
'shop' => $shop,
|
||||||
|
);
|
||||||
|
$urlString = $urlTemplate->render($params);
|
||||||
|
$messageString = $messageTemplate->render($params);
|
||||||
|
|
||||||
$res = $client->request(
|
$res = $client->request(
|
||||||
'POST',
|
'POST',
|
||||||
$urlString,
|
$urlString,
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||||||
);*/
|
);*/
|
||||||
$cacheDriver = new Doctrine_Cache_Array();
|
$cacheDriver = new Doctrine_Cache_Array();
|
||||||
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test') {
|
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test') {
|
||||||
$dsn = 'mysql:dbname=psc_test;host=mysql';
|
$dsn = 'mysql:dbname=psc;host=mysql';
|
||||||
$user = 'psc';
|
$user = 'psc';
|
||||||
$password = 'psc';
|
$password = 'psc';
|
||||||
} elseif (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev') {
|
} elseif (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev') {
|
||||||
|
|||||||
@ -28,7 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
abstract class BaseCreditSystem extends Doctrine_Record
|
abstract class BaseCreditSystem extends Doctrine_Record
|
||||||
{
|
{
|
||||||
public function setTableDefinition() {
|
public function setTableDefinition()
|
||||||
|
{
|
||||||
$this->setTableName('credit_system');
|
$this->setTableName('credit_system');
|
||||||
$this->hasColumn('id', 'integer', 8, array(
|
$this->hasColumn('id', 'integer', 8, array(
|
||||||
'primary' => true,
|
'primary' => true,
|
||||||
@ -100,13 +101,18 @@ abstract class BaseCreditSystem extends Doctrine_Record
|
|||||||
'type' => 'float',
|
'type' => 'float',
|
||||||
'length' => '25',
|
'length' => '25',
|
||||||
));
|
));
|
||||||
|
$this->hasColumn('min_basket_value', 'float', 25, array(
|
||||||
|
'type' => 'float',
|
||||||
|
'length' => '25',
|
||||||
|
));
|
||||||
$this->hasColumn('more', 'boolean', 1);
|
$this->hasColumn('more', 'boolean', 1);
|
||||||
$this->hasColumn('product_id', 'string', 255);
|
$this->hasColumn('product_id', 'string', 255);
|
||||||
$this->hasColumn('articlegroup_id', 'string', 255);
|
$this->hasColumn('articlegroup_id', 'string', 255);
|
||||||
$this->hasColumn('pre_code', 'string', 255);
|
$this->hasColumn('pre_code', 'string', 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp()
|
||||||
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->hasOne('Install', array(
|
$this->hasOne('Install', array(
|
||||||
'local' => 'install_id',
|
'local' => 'install_id',
|
||||||
|
|||||||
@ -2117,6 +2117,7 @@ class BasketController extends TP_Controller_Action
|
|||||||
}
|
}
|
||||||
$creditSystemUUID = $creditSystemRecord->id;
|
$creditSystemUUID = $creditSystemRecord->id;
|
||||||
$creditSystemValue = $creditSystemRecord->wert;
|
$creditSystemValue = $creditSystemRecord->wert;
|
||||||
|
$creditSystemMinBasketValue = $creditSystemRecord->min_basket_value;
|
||||||
$creditSystemPercent = (bool)$creditSystemRecord->percent;
|
$creditSystemPercent = (bool)$creditSystemRecord->percent;
|
||||||
$creditSystemPayment = (bool)$creditSystemRecord->payment;
|
$creditSystemPayment = (bool)$creditSystemRecord->payment;
|
||||||
$creditSystemShipping = (bool)$creditSystemRecord->shipping;
|
$creditSystemShipping = (bool)$creditSystemRecord->shipping;
|
||||||
@ -2323,6 +2324,12 @@ class BasketController extends TP_Controller_Action
|
|||||||
$this->view->productnetto = $netto;
|
$this->view->productnetto = $netto;
|
||||||
$this->view->gutschein = false;
|
$this->view->gutschein = false;
|
||||||
|
|
||||||
|
if ($creditSystemMinBasketValue > 0 && $creditSystemMinBasketValue > ($netto+$mwert)) {
|
||||||
|
$this->view->priorityMessenger('Warenwert zu niedrig', 'success');
|
||||||
|
$basket->setGutschein("");
|
||||||
|
$creditSystemValue=0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($basket->getGutschein() != "") {
|
if ($basket->getGutschein() != "") {
|
||||||
$this->view->gutscheincode = $basket->getGutschein();
|
$this->view->gutscheincode = $basket->getGutschein();
|
||||||
$this->view->gutschein = $creditSystemRecord;
|
$this->view->gutschein = $creditSystemRecord;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $_identity - Identity value
|
* $_identity - Identity value
|
||||||
*
|
*
|
||||||
@ -56,7 +55,7 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
|||||||
{
|
{
|
||||||
$_identity = null;
|
$_identity = null;
|
||||||
|
|
||||||
if($this->_idLogin !== false) {
|
if ($this->_idLogin !== false) {
|
||||||
$row = Doctrine_Query::create()
|
$row = Doctrine_Query::create()
|
||||||
->from('Contact m')
|
->from('Contact m')
|
||||||
->where('m.id= ?', array($this->_idLogin))
|
->where('m.id= ?', array($this->_idLogin))
|
||||||
@ -67,25 +66,25 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
|||||||
|
|
||||||
$shop = Zend_Registry::get('shop');
|
$shop = Zend_Registry::get('shop');
|
||||||
|
|
||||||
if($shop['install_id'] == 4999) {
|
if ($shop['install_id'] == 4999) {
|
||||||
$row = Doctrine_Query::create()
|
$row = Doctrine_Query::create()
|
||||||
->from('Contact m')
|
->from('Contact m')
|
||||||
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND m.install_id = ?', array($this->_identity, $shop['install_id']))
|
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND m.install_id = ?', array($this->_identity, $shop['install_id']))
|
||||||
->execute()->getFirst();
|
->execute()->getFirst();
|
||||||
}elseif($this->_apiLogin) {
|
} elseif ($this->_apiLogin) {
|
||||||
$row = Doctrine_Query::create()
|
$row = Doctrine_Query::create()
|
||||||
->from('Contact m')
|
->from('Contact m')
|
||||||
->leftJoin('m.Shops as s')
|
->leftJoin('m.Shops as s')
|
||||||
->where('m.id = ? AND m.enable = 1 AND s.id = ?', array($this->_identity, $shop['id']))
|
->where('m.id = ? AND m.enable = 1 AND s.id = ?', array($this->_identity, $shop['id']))
|
||||||
->execute()->getFirst();
|
->execute()->getFirst();
|
||||||
}else{
|
} else {
|
||||||
if($shop['useemailaslogin'] == true) {
|
if ($shop['useemailaslogin'] == true) {
|
||||||
$row = Doctrine_Query::create()
|
$row = Doctrine_Query::create()
|
||||||
->from('Contact m')
|
->from('Contact m')
|
||||||
->leftJoin('m.Shops as s')
|
->leftJoin('m.Shops as s')
|
||||||
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', array($this->_identity, $shop['id']))
|
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', array($this->_identity, $shop['id']))
|
||||||
->execute()->getFirst();
|
->execute()->getFirst();
|
||||||
}else{
|
} else {
|
||||||
$row = Doctrine_Query::create()
|
$row = Doctrine_Query::create()
|
||||||
->from('Contact m')
|
->from('Contact m')
|
||||||
->leftJoin('m.Shops as s')
|
->leftJoin('m.Shops as s')
|
||||||
@ -94,14 +93,14 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($row->password == "") {
|
if ($row->password == "") {
|
||||||
return new Zend_Auth_Result(false, $_identity, array('empty password'));
|
return new Zend_Auth_Result(false, $_identity, array('empty password'));
|
||||||
}
|
}
|
||||||
// Es darf diesen Benutzer nur genau 1x geben
|
// Es darf diesen Benutzer nur genau 1x geben
|
||||||
if (!isset($row->id)) {
|
if (!isset($row->id)) {
|
||||||
return new Zend_Auth_Result(false, $_identity, array('Login failure'));
|
return new Zend_Auth_Result(false, $_identity, array('Login failure'));
|
||||||
}
|
}
|
||||||
if($row->locked || $row->Account->locked) {
|
if ($row->locked || $row->Account->locked) {
|
||||||
return new Zend_Auth_Result(false, $_identity, array('Sie wurden gesperrt'));
|
return new Zend_Auth_Result(false, $_identity, array('Sie wurden gesperrt'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,17 +109,41 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
|
|||||||
$row->save();
|
$row->save();
|
||||||
$_identity = $row->toArray(true);
|
$_identity = $row->toArray(true);
|
||||||
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
||||||
|
$dbMongo = TP_Mongo::getInstance();
|
||||||
|
$dbMongo->Job->insertOne(array(
|
||||||
|
"shop" => $shop['id'],
|
||||||
|
"event" => "contact_login",
|
||||||
|
"data" => [ "contact" => $row->uuid ],
|
||||||
|
"created" => new MongoDB\BSON\UTCDateTime(),
|
||||||
|
"updated" => new MongoDB\BSON\UTCDateTime()
|
||||||
|
));
|
||||||
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
||||||
|
|
||||||
}elseif(function_exists('password_verify') && password_verify($this->_credential, $row->password) && !$this->_apiLogin) {
|
} elseif (function_exists('password_verify') && password_verify($this->_credential, $row->password) && !$this->_apiLogin) {
|
||||||
$_identity = $row->toArray(true);
|
$_identity = $row->toArray(true);
|
||||||
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
||||||
|
$dbMongo = TP_Mongo::getInstance();
|
||||||
|
$dbMongo->Job->insertOne(array(
|
||||||
|
"shop" => $shop['id'],
|
||||||
|
"event" => "contact_login",
|
||||||
|
"data" => [ "contact" => $row->uuid ],
|
||||||
|
"created" => new MongoDB\BSON\UTCDateTime(),
|
||||||
|
"updated" => new MongoDB\BSON\UTCDateTime()
|
||||||
|
));
|
||||||
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
||||||
}elseif($this->_apiLogin) {
|
} elseif ($this->_apiLogin) {
|
||||||
$_identity = $row->toArray(true);
|
$_identity = $row->toArray(true);
|
||||||
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
|
||||||
|
$dbMongo = TP_Mongo::getInstance();
|
||||||
|
$dbMongo->Job->insertOne(array(
|
||||||
|
"shop" => $shop['id'],
|
||||||
|
"event" => "contact_login",
|
||||||
|
"data" => [ "contact" => $row->uuid ],
|
||||||
|
"created" => new MongoDB\BSON\UTCDateTime(),
|
||||||
|
"updated" => new MongoDB\BSON\UTCDateTime()
|
||||||
|
));
|
||||||
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
|
||||||
}else{
|
} else {
|
||||||
return new Zend_Auth_Result(false, $_identity, array('Passwort falsch!'));
|
return new Zend_Auth_Result(false, $_identity, array('Passwort falsch!'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user