4 define(
'USER_LOGIN_SUCCESS', 1);
5 define(
'USER_LOGIN_FAIL', 2);
6 define(
'USER_LOGOUT', 3);
112 if ($this->
getParent()->isEnabledPrivateSales()) {
115 $sClass = $this->
getParent()->getClassName();
118 if (!$oUser && !in_array($sClass, $this->_aAllowedClasses)) {
122 if ($oUser && !$oUser->isTermsAccepted() && !in_array($sClass, $this->_aAllowedClasses)) {
144 if ($oUser->inGroup(
'oxidblocked')) {
145 $sUrl =
$myConfig->getShopHomeURL() .
'cl=content&tpl=user_blocked.tpl';
150 if ($oUser->isLoadedFromCookie() && !
$myConfig->getConfigParam(
'blPerfNoBasketSaving')) {
152 if ($oBasket = $this->
getSession()->getBasket()) {
154 $oBasket->onUpdate();
184 $oUser =
oxNew(
'oxuser');
185 $oUser->login($sUser, $sPassword, $sCookie);
189 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'',
false);
223 $oSession->regenerateSessionId();
229 if ($oUser->inGroup(
'oxidblocked')) {
230 $sUrl =
$myConfig->getShopHomeURL() .
'cl=content&tpl=user_blocked.tpl';
235 if ($oBasket = $oSession->getBasket()) {
236 $oBasket->onUpdate();
251 if ($this->
getParent()->isEnabledPrivateSales() && $blAgb !== null && ($oUser = $this->
getUser())) {
253 $oUser->acceptTerms();
258 if (!$this->
isAdmin() && !$this->
getConfig()->getConfigParam(
'blPerfNoBasketSaving')) {
261 if ($oBasket = $this->
getSession()->getBasket()) {
281 if ($oUser = $this->
getUser()) {
283 if ($oUser->updateFbId()) {
303 if (($oBasket = $this->
getSession()->getBasket())) {
304 $oBasket->resetUserInfo();
305 $oBasket->onUpdate();
322 $oUser =
oxNew(
'oxuser');
324 if ($oUser->logout()) {
332 if ($this->
getParent()->isEnabledPrivateSales()) {
356 if ($blUserRegistered ===
true) {
359 return $blUserRegistered;
376 return 'account_user';
402 $blActiveLogin = $this->
getParent()->isEnabledPrivateSales();
406 if ($blActiveLogin && !$oConfig->getRequestParameter(
'ord_agb') && $oConfig->getConfigParam(
'blConfirmAGB')) {
407 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay(
'READ_AND_CONFIRM_TERMS',
false,
true);
413 $sUser = $oConfig->getRequestParameter(
'lgn_usr');
416 $sPassword = $oConfig->getRequestParameter(
'lgn_pwd',
true);
419 $sPassword2 = $oConfig->getRequestParameter(
'lgn_pwd2',
true);
421 $aInvAdress = $oConfig->getRequestParameter(
'invadr',
true);
425 $oUser =
oxNew(
'oxuser');
429 $oUser->checkValues($sUser, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
431 $iActState = $blActiveLogin ? 0 : 1;
435 $oUser->setPassword($sPassword);
439 $iSubscriptionStatus = $oUser->getNewsSubscription()->getOptInStatus();
441 $oUser->createUser();
442 $oUser->load($oUser->getId());
443 $oUser->changeUserData($oUser->oxuser__oxusername->value, $sPassword, $sPassword, $aInvAdress, $aDelAdress);
445 if ($blActiveLogin) {
447 $oUser->acceptTerms();
452 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled') && $sUserId && $sRecEmail) {
454 $oUser->setCreditPointsForRegistrant($sUserId, $sRecEmail);
459 if ($blOptin && $iSubscriptionStatus == 1) {
463 $oUser->getNewsSubscription()->setOptInStatus(1);
464 $oUser->addToGroup(
'oxidnewsletter');
465 $this->_blNewsSubscriptionStatus = 1;
467 $blOrderOptInEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
468 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blOrderOptInEmailParam);
471 $oUser->addToGroup(
'oxidnotyetordered');
488 if (!$blActiveLogin) {
505 $oxEMail =
oxNew(
'oxemail');
506 if ($blActiveLogin) {
507 $oxEMail->sendRegisterConfirmEmail($oUser);
509 $oxEMail->sendRegisterEmail($oUser);
514 $this->_blIsNewUser =
true;
516 $sAction =
'payment?new_user=1&success=1';
517 if ($this->_blNewsSubscriptionStatus !== null && !$this->_blNewsSubscriptionStatus) {
518 $sAction =
'payment?new_user=1&success=1&newslettererror=4';
532 if ($this->createuser() !=
false && $this->_blIsNewUser) {
533 if ($this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus) {
534 return 'register?success=1';
536 return 'register?success=1&newslettererror=4';
549 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled')) {
563 if (!isset($blShow)) {
564 $blShow = $oSession->getVariable(
'blshowshipaddress');
567 $oSession->setVariable(
'blshowshipaddress', $blShow);
585 if (!$this->
getSession()->checkSessionChallenge()) {
601 $sUserName = $oUser->oxuser__oxusername->value;
602 $sPassword = $sPassword2 = $oUser->oxuser__oxpassword->value;
605 $oUser->changeUserData($sUserName, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
608 $blOptin = $oUser->getNewsSubscription()->getOptInStatus();
611 $sBillingUsername = $aInvAdress[
'oxuser__oxusername'];
612 $blForceCheckOptIn = ($sBillingUsername !== null && $sBillingUsername !== $sUserName);
613 $blEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
614 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blEmailParam, $blForceCheckOptIn);
624 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'input_not_all_fields');
644 if ($oBasket = $this->
getSession()->getBasket()) {
645 $oBasket->setBasketUser(null);
646 $oBasket->onUpdate();
664 $aDeladr = ($blShowShipAddressParameter || $blShowShipAddressVariable) ? $sDeliveryAddressParameter : array();
665 $aDelAdress = $aDeladr;
667 if (is_array($aDeladr)) {
669 if (isset($aDeladr[
'oxaddress__oxsal'])) {
670 unset($aDeladr[
'oxaddress__oxsal']);
672 if (!count($aDeladr) || implode(
'', $aDeladr) ==
'') {
674 $aDelAdress = array();
690 $sLogoutLink = $oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
691 $sLogoutLink .=
'cl=' . $oConfig->getRequestParameter(
'cl') . $this->
getParent()->getDynUrlParams();
692 if ($sParam = $oConfig->getRequestParameter(
'anid')) {
693 $sLogoutLink .=
'&anid=' . $sParam;
695 if ($sParam = $oConfig->getRequestParameter(
'cnid')) {
696 $sLogoutLink .=
'&cnid=' . $sParam;
698 if ($sParam = $oConfig->getRequestParameter(
'mnid')) {
699 $sLogoutLink .=
'&mnid=' . $sParam;
701 if ($sParam = $oConfig->getRequestParameter(
'tpl')) {
702 $sLogoutLink .=
'&tpl=' . $sParam;
704 if ($sParam = $oConfig->getRequestParameter(
'oxloadid')) {
705 $sLogoutLink .=
'&oxloadid=' . $sParam;
707 if ($sParam = $oConfig->getRequestParameter(
'recommid')) {
708 $sLogoutLink .=
'&recommid=' . $sParam;
711 return $sLogoutLink .
'&fnc=logout';
721 $this->_iLoginStatus = $iStatus;