/**
  * @return string
  */
 protected static function refuseToU()
 {
     MMUserLogin::logoutUser();
     CookieTool::destroyCookie( 'remember_me' );
     $redirectURL = ContextTool::instance()->domain().'/logoutActions.php';
     return $redirectURL;
 }
    /**
     * @param int[] $applicationIds
     * @return int[]
     */
    public function store($applicationIds = null)
    {
        $oldApplicationIds = false;
        if($this->user())
        {
            $oldApplicationIds = $this->user()->getApplicationList();
        }

        if( is_array($applicationIds) )
        {
            $this->_applicationIds = $applicationIds;
        }

        if ( !$this->user() )
        {
            CookieTool::destroyCookie(self::COOKIE_UNORDERED_APPLIST_KEY);
            return null;
        }

        $applicationIds = $this->applicationIds();
        $this->user()->setApplicationList($applicationIds);
        $this->user()->setCookie();

        sort($applicationIds);

        CookieTool::setCookie( self::COOKIE_UNORDERED_APPLIST_KEY, $applicationIds );

        if($oldApplicationIds)
        {
            $diff = array_values(array_diff($oldApplicationIds, $this->_applicationIds));

            if(is_array($diff) && count($diff) > 1)
            {
                return $diff;
            }

            else if(count($diff) == 1)
            {
                $idDeleted  = $diff[0];
                $apps       = CountryApplicationLibrary::fetchAuthorizedApplicationIds();

                if( !in_array($idDeleted, $apps) )
                {
                    return false;
                }

                return $diff;
            }
        }
        return false;
    }
Ejemplo n.º 3
0
    public static function logoutUser()
    {
        session_destroy();
        if( UserLog::canStore() )
        {
            $user = MMUsers::getCurrentUserObject();
            UserLog::instance()->action('logout');

            if( $user )
                UserLog::instance()->uuid( $user->attribute( 'uuid' ) );
            else
                UserLog::instance()->uuid('Unknown')->msg('Logout called for not logged in user');

            UserLog::instance()->store();
        }

        AppBarControl::instance()->store();

        $user = eZUser::instance();
        // Remove all temporary drafts
        eZContentObject::cleanupAllInternalDrafts( $user->attribute( 'contentobject_id' ) );

        // destroy t3 cookies
        // temporary fix - we are reaching the header size limit
        // self::destroyApplicationCookie( 't3process' );

        MMSelections::destroyCookie();
        MMUsers::destroyCookieUserPreferences();
        CookieTool::destroyCookie( 'catchUpSpe' );
        CookieTool::destroyCookie( 'displayToUPPPopin' );
        CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
        CookieTool::destroyCookie( 'displayToUPPPage' );
        CookieTool::destroyCookie( 'displayToUPPPage', '/', null );
        CookieTool::destroyCookie( MMUsers::COOKIE_KEY );
        CookieTool::destroyCookie(session_name());
    }
Ejemplo n.º 4
0
        {
            $context = ContextTool::instance()->domain() . $context;
        }
        if ( ContextTool::instance()->checkRedirectUrl( $context ) )
        {
            $redirectURL .= '?context='.urlencode( $context );
        }
    }

}

$isUserAction = ( isset( $Params['isUserAction'] ) && $Params['isUserAction'] );
if( $isUserAction )
{
    CookieTool::destroyCookie( 'remember_me' );
    CookieTool::destroyCookie( 'unorderedAppList' );
    CookieTool::destroyCookie( eZINI::instance( 'merck.ini' )->variable( 'TIBCOCookieSettings', 'TIBCOCookieName' ) );
    $cookiesToInvalidate = eZINI::instance( 'merck.ini' )->variable( 'LogoutSettings', 'InvalidateCookies' );
    if (is_array($cookiesToInvalidate))
    {
        foreach ($cookiesToInvalidate as $cookie)
        {
            CookieTool::destroyCookie( $cookie );
        }
    }
}

header("Location: $redirectURL");
eZExecution::cleanExit();

Ejemplo n.º 5
0
<?php

if ( MMUsers::getCurrentUserObject() )
{
    header( 'Content-Type: application/json' );

    if ( isset( $_POST['remove_cookie'] ) )
    {
        CookieTool::destroyCookie( 'displayToUPPPopin' );
        CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
        CookieTool::destroyCookie( 'displayToUPPPage' );
        CookieTool::destroyCookie( 'displayToUPPPage', '/', null );
        echo json_encode( array( 'result' => 0 ) );
        eZExecution::cleanExit();
    }

    $service = ESBFactory::getUserService();
    $userProfile = $service->form();

    $touPage = MMStaticPage::fetchPageByInternalId( 'terms-of-use' );

    $privacyPolicyPageInternalId = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'shortPrivacyPolicyPageInternalId' );
    $privacyPolicyPageInternalId = ( $privacyPolicyPageInternalId === false || is_null( $privacyPolicyPageInternalId ) || trim( $privacyPolicyPageInternalId ) == "" ) ? 'privacy-policy' : $privacyPolicyPageInternalId;
    $ppPage  = MMStaticPage::fetchPageByInternalId( $privacyPolicyPageInternalId );

    $currentToUConsentVersion       = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentToUConsentVersion' );
    $currentPPConsentVersion        = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentPPConsentVersion' );
    $hasCheckbox                    = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'hasCheckbox' );
    $precheckedCheckbox             = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'precheckedCheckbox' );
    $adaptConsentText               = in_array( ClusterTool::clusterIdentifier(), array( 'cluster_uk' ) ) ? true : false;
    private function iframeBuildResult()
    {
        $url = $_COOKIE[$this->cookieKey()];

        CookieTool::destroyCookie($this->cookieKey(), '/', null);

        if($url == 1)
        {
            if ( $this->applicationObject()->externalLinkHandler() )
            {
                $url = $this->applicationObject()->externalLinkHandler()->getNodeUrl( $this->node );
                $url = $this->getDeeplink( $url );
            }
            else
            {
                $url = '/bad_config';
            }
        }
        if ($url == null && isset($_REQUEST['r']))
        {
            $url = urldecode($_REQUEST['r']);
        }

        $backUrl    = isset($_REQUEST['bu']) ? $_REQUEST['bu'] : eZINI::instance()->variable('SiteAccessSettings', 'BaseUrl');

        if ( $this->isDeeplinkApplication() )
        {
            $redirect = !$this->displayIframe();
        }
        else
        {
            $redirect = ( $this->mustRedirect() || ( isset($_REQUEST['r']) && $_REQUEST['r'] ) );
        }

        if ( !$this->isOnExitPageView() && !$this->displayIframe() )
        {
            $redirect = true;
        }

        // Trick used for pages that needed POST form submit, that coudn't be done by CURL.
        $usePostMethod = SolrSafeOperatorHelper::getCustomParameter( $this->applicationObject->identifier, 'usePostMethod', 'application' );
        if( $redirect && !$usePostMethod && (!$this->isOnExitPageView() || !$this->displayIframe()))
        {
            header('Location: '.$url);
            eZExecution::cleanExit();
        }

        $applicationList = AppBarControl::instance()->applicationIds();
        sort($applicationList);

        $displayIframe = true;
        if ( !$this->isOnExitPageView() )
        {
            $displayIframe = $this->displayIframe();
        }
        $url = in_array('arg', array_keys($this->_params['UserParameters'])) ? $url . $this->_params['UserParameters']['arg'] : $url;
        $this->pushResult('iframe'          , $displayIframe);
        $this->pushResult('url'             , $url);
        $this->pushResult('back_url'        , $backUrl);
        $this->pushResult('app_list_hash'   , md5( $this->user() ? json_encode($applicationList) : 'anonymous' ));
        $this->pushResult('add_to_my_apps'  , ( $this->user() && $this->applicationObject->getParent() != null && !in_array( $this->getApplicationId(), AppBarControl::instance()->applicationIds() ) && $this->getApplicationId() != 0));
        $this->pushResult('app'             , $this->applicationObject());
        $oldSkipPage = SolrSafeOperatorHelper::getCustomParameter($this->applicationObject->identifier, 'SkipExitPage', 'application');
        $skipPage = $oldSkipPage || !$this->exitStrategy();
        // hack to redirect external apps which doesn't have entry exits
        if( $this->isOnExitPageView() && $skipPage )
        {
            $this->pushResult('skip_exit_page_redirect', true);
        }
    }
Ejemplo n.º 7
0
 public static function destroyCookie()
 {
     CookieTool::destroyCookie( self::COOKIE_KEY );
 }
Ejemplo n.º 8
0
 /**
  * @return bool
  */
 public static function logout()
 {
     MMUserLogin::logoutUser();
     CookieTool::destroyCookie('remember_me');
     return true;
 }
    /**
     * Creates a profile
     *
     * @return array
     */
    public function create()
    {
        if( SolrSafeOperatorHelper::featureIsActive( 'RegistrationSettings' ) && SolrSafeOperatorHelper::feature( 'RegistrationSettings', 'DisableRegistration' ) == true ) {
            return array( 'data' => array( 'errorCode'=> 9 ) ); 
        }

        // 1st step - Checks fields
        $r = $this->checkUsername();
        if ( $r !== true )
        {
            return $r;
        }

        $r = $this->checkEmail();
        if ( $r !== true )
        {
            return $r;
        }
        $isHtmlEntitiesAlowed = self::isAddressEncodeAllowedOnCluster();

        // 2nd step - Process fields
        $addressLine1 = $this->getBusinessNameMapping( 'addressLine1' );
        if ( isset( $_POST[$addressLine1] ) && !empty( $_POST[$addressLine1] ) && $isHtmlEntitiesAlowed )
        {
            $_POST[$addressLine1] = htmlentities( $_POST[$addressLine1], ENT_QUOTES, 'UTF-8' );
        }

        $addressLine2 = $this->getBusinessNameMapping( 'addressLine2' );
        if ( isset( $_POST[$addressLine2] ) && !empty( $_POST[$addressLine2] ) && $isHtmlEntitiesAlowed  )
        {
            $_POST[$addressLine2] = htmlentities( $_POST[$addressLine2], ENT_QUOTES, 'UTF-8' );
        }

        /* @type $createParams array */
        $params       = array();
        $createParams = SolrSafeOperatorHelper::clusterIni('EsbSettings', 'CreateParamsTypes', 'merck.ini' );
        foreach ( $createParams as $key => $value )
        {
            if ( isset( $_POST[$key] ) )
            {
                $params[$key] = ( trim( $value ) == 'int' ) ? intval( $_POST[$key] ) : $_POST[$key];
            }            
        }

        $actId = $this->getBusinessNameMapping( 'actId' );
        if ( isset( $_REQUEST[$actId] ) )
        {
            $params[$actId] = $_REQUEST[$actId];
        }

        if ( $this instanceof ServiceUserUUMP )
        {
            $params['privacyPolicyDate'] = date('Ymdhis');
        }

        // managing validation status cases
        // 1. Override taken from cluster settings.
        $defaultValidationStatus = SolrSafeOperatorHelper::clusterIni('DefaultValidationStatus', 'DefaultValidationStatus', 'merck.ini' );
        $defaultValidationStatus = !empty( $defaultValidationStatus ) && isset( $defaultValidationStatus ) ? $defaultValidationStatus : 'PV' ;
        if( $this instanceof ServiceUserUUMP && !empty( $defaultValidationStatus ) && isset( $defaultValidationStatus ) )
        {
            $params['validationStatus'] = $defaultValidationStatus;
        }

        // 2. Russian helpdesk-register validates user by default.
        if( isset( $_POST['register-helpdesk']) && $_POST['register-helpdesk'] == 1 && !isset( $_POST['termsOfUse'] ))
        {
            $params['validationStatus'] = 'VP';

            $params['termsOfUse'] = isset( $_POST['helpdeskTermsOfUse']) ? 1 : 0;
            $params['privacyPolicy'] = isset( $_POST['helpdeskPrivacyPolicy']) ? 1 : 0;
        }

        // 3. German "kontakt" validation result.
        if ( $this instanceof ServiceUserUUMP && isset( $params['WEB_SERVICE_AJAX_FIELD_1'] ) )
        {
            if( $params['WEB_SERVICE_AJAX_FIELD_1'] == "kontakt" )
            {
                $params['validationStatus'] = 'PV';
            }
            unset( $params['WEB_SERVICE_AJAX_FIELD_1'] );            
        }

        // 4. German "DocCheck" validation result.
        if ( $this instanceof ServiceUserUUMP && ( isset( $params['DocCheck_username'] ) && $params['DocCheck_username'] != "" ) && ( isset( $params['Password_doccheck'] ) && $params['Password_doccheck'] != "" ) )
        {
            $params['validationStatus'] = 'VP';
            unset( $params['DocCheck_username'] );
            unset( $params['Password_doccheck'] );
        }

        // 5. US 1.8 if user is validated by eshcp we have crmMemberId field stored, so we also must validate user with VP
        if ( SolrSafeOperatorHelper::featureIsActive( "Univadis18Redesign" ) && isset($params['crmMemberId']) && $params['crmMemberId'] != "" )
        {
            $params['validationStatus'] = 'VP';
        }

        // 3rd step - ESB Create
        $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_language' );
        if( !is_null( $sl ) )
        {
            $language = $sl;
        }
        else
        {
            $language = eZINI::instance( 'site.ini' )->variable( 'RegionalSettings', 'ContentObjectLocale' );
            $merckIni = eZINI::instance( 'merck.ini' );
            if ( $merckIni->hasVariable( 'EsbSettings', 'Language' ) )
            {
                $language = $merckIni->variable( 'EsbSettings', 'Language' );
            }
        }

        $apps = array();
        $appsIds = CountryAppsBar::fetchAppsBarApplicationIds( $_POST[$this->getBusinessNameMapping( 'customerType' )] );
        foreach ( $appsIds as $key => $value )
        {
            $apps[] = array(
                $this->getBusinessNameMapping( 'appId' )    => $value,
                $this->getBusinessNameMapping( 'appOrder' ) => $key + 1
            );
        }

        $subsUni = $this->getUnivadisSubscriptions();
        $subsMsd = $this->getMsdSubscriptions();
        $subsSun = $this->getSunshineAct();

        $consents = array_merge( $subsUni, $subsMsd );
        if(!empty($subsSun))
        {
            $consents = array_merge( $consents, $subsSun );
        }

        if( $createParams[self::SUBSCRIPTION_PHONE_CONSENT] )
        {
            $consents[] = array(
                'consentCode'       => self::SUBSCRIPTION_PHONE_CONSENT,
                'consentStatus'     => !empty( $_POST[self::SUBSCRIPTION_PHONE_CONSENT] ) ? self::SUBSCRIPTION_STATUS_SUBSCRIBED : self::SUBSCRIPTION_STATUS_UNSUBSCRIBED,
                'consentLastUpdate' => time(),
            );
            unset( $params[self::SUBSCRIPTION_PHONE_CONSENT] );
        }

        // Add terms of use, private policies and OptIn consents
        if ( SolrSafeOperatorHelper::featureIsActive( 'ToUPPPopin' ) && ( $this instanceof ServiceUserUUMP ) )
        {
            $touVersion = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentToUConsentVersion' );
            $ppVersion  = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentPPConsentVersion' );

            $consents[] = array(
                'consentCode'       => 'termsOfUse_v' . $touVersion,
                'consentStatus'     => 'S',
                'consentLastUpdate' => time(),
            );

            $consents[] = array(
                'consentCode'       => 'privacyPolicy_v' . $ppVersion,
                'consentStatus'     => 'S',
                'consentLastUpdate' => time()
            );

            $subsOptIn = $this->getOptInSubscriptions();
            if ( !empty( $subsOptIn ) )
            {
                $consents = array_merge( $consents, $subsOptIn );
            }
        }

        $username = $this->getUsername();

        $userSpecialty = $_POST[$this->getBusinessNameMapping( 'userSpecialty' )];
        $mainSpecialty = UserSpecialityContentSpeciality::getContentSpeciality( $userSpecialty );


        $unifiedParameters = array(
            $this->getBusinessNameMapping( 'emailAddress' )          => $_POST[$this->getBusinessNameMapping( 'emailAddress' )],
            $this->getBusinessNameMapping( 'password' )              => $_POST[$this->getBusinessNameMapping( 'password' )],
            $this->getBusinessNameMapping( 'firstName' )             => $_POST[$this->getBusinessNameMapping( 'firstName' )],
            $this->getBusinessNameMapping( 'lastName' )              => $_POST[$this->getBusinessNameMapping( 'lastName' )],
            $this->getBusinessNameMapping( 'language' )              => $language,
            $this->getBusinessNameMapping( 'userSpecialty' )         => $userSpecialty,
            $this->getBusinessNameMapping( 'customerType' )          => $_POST[$this->getBusinessNameMapping( 'customerType' )],
            $this->getBusinessNameMapping( 'apps' )                  => $apps,
            $this->getBusinessNameMapping( 'consents' )              => $consents,
            $this->getBusinessNameMapping( 'additionalSpecialties' ) => MMUserLogin::getAddSpecialties( $mainSpecialty ),
            $this->getBusinessNameMapping( 'countryOfRegistration' ) => $this->getCountryOfRegistration(),
            $this->getBusinessNameMapping( 'countryOfResidence' )    => $_POST[$this->getBusinessNameMapping( 'countryOfResidence' )],
        );

        if ( isset( $_POST[$this->getBusinessNameMapping( 'secondName' )] ) )
        {
            $unifiedParameters[$this->getBusinessNameMapping( 'secondName' )] = $_POST[$this->getBusinessNameMapping( 'secondName' )];
        }

        if ( !is_null($username))
            $unifiedParameters[$this->getBusinessNameMapping( 'userName' )] = $username;

        if ( $this instanceof ServiceUserUUMP )
        {

            $parameters = array(
                'data' => array(
                    'profile' => $unifiedParameters
                )
            );

            $formatDate                 = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'FormatDate', 'merck.ini' );
            $availableDateParams        = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'AvailableDateParams', 'merck.ini' );
            $skipParametersIfEmptyValue = SolrSafeOperatorHelper::clusterIni('SkipParametersIfEmptyValue', 'SkipParameter', 'merck.ini' );
           
            foreach ( $params as $key => $value )
            {                
                if ( array_key_exists( $key, $parameters['data']['profile'] ) )
                {
                    unset( $params[$key] );
                }
                if( !empty( $availableDateParams ) && isset( $availableDateParams[$key] ) && !empty($value)  )
                {
                    $params[$key] = $this->convertDateforUUMP( $value, $formatDate );
                }
                if( !empty( $skipParametersIfEmptyValue ) && isset( $skipParametersIfEmptyValue[$key] ) && empty($value) )
                {
                    unset( $params[$key] );
                }
            }
            $parameters['data']['profile'] = array_merge( $parameters['data']['profile'], $params );

            $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' );
            if ( !is_null( $sl ) )
            {
                $parameters['data']['profile']['locale'] = $sl;
            }
        }
        else
        {
            $parameters = array(
                'Data' => array_merge( $unifiedParameters, array( 'Params' => $params ) ),
                'cr'   => $this->getCountryOfRegistration()
            );
        }

        //LOG for locale field UUMP #36428
        if ( $this instanceof ServiceUserUUMP )
        {
            if( empty( $parameters['data']['profile']['locale'] ) )
            {
                $errorLocalMsg =  "\n\nEMPTY LOCALE:\nVALUES: " . json_encode( $parameters );
                \eZLog::write( $errorLocalMsg, 'esb_uump_locale.log');
            }
        }
        $result = $this->callWSHandler( $this->getEsbInterface( 'create' ), $parameters );

        if( SolrSafeOperatorHelper::featureIsActive('RegistrationAutologin') && SolrSafeOperatorHelper::feature('RegistrationAutologin', 'DisallowPendingUsers') == true && !isset( $_POST['register-helpdesk'] ))
        {
            if( $result['data']['profile']['validationStatus'] == 'PV' )
            {
                $result['RedirectPending'] = true;
                $result['RedirectPendingHref'] = eZINI::instance( 'site.ini' )->variable( 'SiteSettings', 'PendingUserStaticPage' );
                return $result;
            }
        }

        // if the registration was successful, we need to log the user on eZ + Backend side too
        if ( $this instanceof ServiceUserUUMP )
        {
            $noErrorOnCreate = ( isset( $result['data']['errorCode'] ) && $result['data']['errorCode'] == 0 );
        }
        else
        {
            $noErrorOnCreate = ( isset( $result['Data']['ErrorCode'] ) && $result['Data']['ErrorCode'] == 0 );
        }

        if ( $noErrorOnCreate )
        {
            $allowRedirect            = false;
            $availableRedirectContext = SolrSafeOperatorHelper::feature( 'RegistrationSettings', 'AvailableContextList' );
            $context                  = $_POST['context'] != '' ? $_POST['context'] : null;

            if ( $context !== null && !empty( $availableRedirectContext ) )
            {
                if ( is_array( $availableRedirectContext ) && in_array( $context, $availableRedirectContext ) )
                {
                    $allowRedirect = true;
                }
            }

            // BUT only there is no pending validation needed
            // OR if we are on that local validation page
            if ( ( !SolrSafeOperatorHelper::featureIsActive( 'OverrideWSHandler' ) || self::verifyHash() ) && !isset( $_POST['register-helpdesk'] ))
            {
                if ( $this instanceof ServiceUserUUMP )
                {
                    $userName   = isset( $result['data']['profile']['userName'] ) ? $result['data']['profile']['userName'] : null;
                    $userId     = $result['data']['profile']['userId'];
                    $userSpecialty = isset( $result['data']['profile']['userSpecialty'] ) ? preg_replace('#^A#', '', $result['data']['profile']['userSpecialty']) : null;
                }
                else
                {
                    $readValues = $this->read( array( "User_specialty" ), $result['Data']['Username'] );
                    $parameters = $parameters['Data']['Params'];
                    $userName = isset( $result['Data']['Username'] ) ? $result['Data']['Username'] : null;
                    $userSpecialty = isset( $readValues['Data']['Params']['User_specialty'] ) ? $readValues['Data']['Params']['User_specialty'] : null;
                }

                $businessNames = $this->getBusinessNamesForTicket();
                $ticketParams  = array();
                foreach ( $businessNames as $ticketParam => $businessName )
                {
                    if ( isset( $parameters['data']['profile'][$businessName] ) )
                    {
                        $ticketParams[$ticketParam] = $parameters['data']['profile'][$businessName];
                    }
                    elseif ( isset( $_POST[$businessName] ) )
                    {
                        $ticketParams[$ticketParam] = $_POST[$businessName];
                    }
                    elseif ( $businessName == $this->getBusinessNameMapping( 'countryOfRegistration' ) )
                    {
                        $ticketParams[$ticketParam] = $this->getCountryOfRegistration();
                    }
                    else
                    {
                        eZDebug::writeError( 'Could not get registration param: ' . $businessName );
                    }
                }

                if( $this instanceof ServiceUserUUMP )
                {
                    $ticketParams['Username'] = $userId;
                }
                elseif ( !empty($userName) )
                {
                    $ticketParams['Username'] = $userName;
                }
                
                if ( !empty($userSpecialty) )
                {
                    $ticketParams['User_specialty'] = $userSpecialty;
                }
                
                // used in response to log to the php backend
                $result['AllowRedirect'] = $allowRedirect;

                $ticketParams['toUValidated'] = true;

                MMUserLogin::loginUser( $ticketParams );
                $mmUser = MMUsers::getCurrentUserObject();
                $ticketParams['mmSettings']       = $mmUser->getMMSettings();
                $ticketParams['unorderedAppList'] = $mmUser->getApplicationList();
                $ticketParams['alterboxMsgReset'] = $mmUser->hasPreference('alterboxMsgReset') ? $mmUser->getPreferences('alterboxMsgReset') : true;
                $result['Ticket'] = MMUserLogin::encryptText( json_encode( $ticketParams ) );

            }
        }
        // Consult Popin for France | mobile check disabled - it fails on STG
        if (/* ContextTool::instance()->isMobile() && */ in_array(ClusterTool::clusterIdentifier(), array('cluster_france'))) 
        {
            CookieTool::destroyCookie('displayConsultMobile');
            CookieTool::destroyCookie('displayConsultMobile', '/', null);
            CookieTool::setCookie('displayConsultMobile', $mmUser->getConsult(), time() + ( 2 * 24 * 60 * 60 ));
        }

        if( isset( $_POST['register-helpdesk'] ))
        {
            $result['helpdeskRegister'] = '1';
        }


        return $result;
    }
Ejemplo n.º 10
0
    protected function sessionCheck()
    {
        $esiKey = isset($_GET['key']) ? $_GET['key'] : null;
        if (   $esiKey
            && $esiKey != static::ANONYMOUS_ESIKEY
            && !self::user()
        ) {
            // logged-in key given and no eZ Session.
            HttpTool::noHTTPCache();
            CookieTool::destroyCookie(MMUsers::COOKIE_KEY);

            $newRelicApi = new \klpNrApi();
            $newRelicApi->setCustomMetric( 'Custom/Issues/HalfLogged', 1 );

            $this->tpl()->setVariable(  'forceUserLogout',
                                        MMUsers::COOKIE_KEY . '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'
            );
        }

        return true;
    }
Ejemplo n.º 11
0
 public static function destroyCookieUserPreferences()
 {
     CookieTool::destroyCookie( 'alterboxMsgReset' );
     CookieTool::destroyCookie( 'gpNotebookHS' );
     CookieTool::destroyCookie( 'nccn_guidelines_approval_expiration' );
     CookieTool::destroyCookie( 'medicalNewsDemo' );
 }
    public function relog()
    {
        $uuid       = isset( $this->_input['uuid'] ) ? $this->_input['uuid'] : null;
        //$h          = isset( $_COOKIE['h'] ) ? $_COOKIE['h'] : null;
        $h          = isset( $this->_input['h'] ) ? $this->_input['h'] : null;
        $context    = isset( $this->_input['context'] ) ? $this->_input['context'] : ContextTool::instance()->domain().'/';

        //delete session id cookie
        //unset($_COOKIE['h']);

        if ( is_null( $uuid ) || is_null( $h ) )
        {
            MMUserLogin::logError( $uuid, null, null, 'Empty uuid or hash given on Relog' );
            return $this->relogError();
        }

        if ( $h != sha1( eZINI::instance( 'merck.ini' )->variable( 'TicketLogin', 'DESKey' ) . $uuid ) )
        {
            MMUserLogin::logError( $uuid, null, null, 'Invalid hash given on Relog' );
            return $this->relogError();
        }

        UserLog::instance()->action( 'rememberme' )->uuid( $uuid )->step( 'received' )->store();

        $esbResult = new ESBResult();
        
        if ( !SolrSafeOperatorHelper::featureIsActive('UUMP') )
        {
            $datas = static::readCall( $uuid, $esbResult );
        }
        else
        {
            $readService = ESBFactory::getUserService();
            $parameters  = $readService->getFormParameters($uuid);
            $datas       = $readService->read( $parameters, $uuid );
        }

        $isPopulated = static::populateESBResult( $esbResult, $datas );
        $this->_esbResult = $esbResult;
        
        if ( !$isPopulated )
        {
            // error log caught on WS stack
            return $this->relogError();
        }
        
        $esbResult->login = ( $esbResult->userId === $uuid );
        

        if ( !$isPopulated )
        {
            // error log caught on WS stack
            return $this->relogError();
        }

        $loginResult = MMUserLogin::esbLogin( $uuid, $esbResult, true, $context );

        if ( $loginResult )
        {
            $this->_isLoginSuccessful = true;
            $this->_destUrl = $loginResult['destUrl'];

            UserLog::instance()
                ->uuid( $uuid )
                ->esb_status( 'Accepted' )
                ->store();

            $user = MMUsers::getCurrentUserObject();

            $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_language' );
            $customerLanguage = !is_null( $sl ) ? $sl : eZINI::instance()->variable( 'RegionalSettings', 'ContentObjectLocale' );

            if( SolrSafeOperatorHelper::featureIsActive( 'AsynchronousAnalyticsLoginCall' ) && SolrSafeOperatorHelper::feature( 'AsynchronousAnalyticsLoginCall', 'GoogleAnalytics' ) )
            {
                $amq = new ActiveMQManager();
                $domains = eZINI::instance( 'merck.ini' )->variable( 'DomainMappingSettings', 'ClusterDomains' );
                $domain  = isset( $domains[ClusterTool::clusterIdentifier()] ) ? $domains[ClusterTool::clusterIdentifier()] : 'unidentified.univadis.com';
                $gasl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'ga_visitor_country' );
                $gaCountry = !is_null( $gasl ) ? $gasl : $user->attribute( 'country' );
                $gaParams = array(
                    'v'   => 1,
                    'tid' => 'UA-41415675-6',
                    'uid' => $uuid,
                    't'   => 'event',
                    'ec'  => 'esb',
                    'ea'  => 'login',
                    'ni'  => 1,
                    'cd1' => $uuid,
                    'cd2' => 'logged',
                    'cd7' => $gaCountry,
                    'dh'  => preg_replace( '#^.*?\.#', '', $domain ),
                );
                $gaParams = 'https://ssl.google-analytics.com/collect?' . http_build_query( $gaParams );
                $amq->sendMessageToQueue( 'portail.analytics.google', $gaParams );
            }

            // Stringify params
            $loginResult['params'][AppBarControl::COOKIE_UNORDERED_APPLIST_KEY] = $user->getApplicationList();
            $loginResult['params'][MMUsers::COOKIE_KEY] = $user->getMMSettings();
            $strParams = json_encode( $loginResult['params'] );

            // Encrypts params
            $encryptedParams = MMUserLogin::encryptText( $strParams );
            // Redirect to PHP-ESI
            $redirectURL = "/loginActions.php?context=" . urlencode( $loginResult['destUrl'] ) . "&params=" . urlencode( $encryptedParams );
            if ( !MMUsers::checkCookieLaw() && SolrSafeOperatorHelper::feature('CookieLaw', 'Mode') == MMUsers::COOKIE_LAW_ACTIVE_VERSION_KEY)
            {
                $cookieLawPage = SolrSafeOperatorHelper::feature( 'CookieLaw', 'CookieLawPage' );
                $redirectURL   = ( $cookieLawPage ? $cookieLawPage : '/page/cookie-law' );
            }

            // Branding reconsent check, done only if:
            // 1. feature ToUPPPopin enabled
            // 2. Always on WEB with this feature
            // 3. Only on mobile, whne setting showOnMobile is ON.
            if
            (
                SolrSafeOperatorHelper::featureIsActive( 'ToUPPPopin')
                &&
                (
                    !ContextTool::instance()->isMobile()
                    ||
                    ( ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature('ToUPPPopin','showOnMobile') )
                )
            )
            {
                $displayReconsent = $this->checkTouPPPopin( $datas );
                // if we need to ask user for reconsent ($displayReconsent - taken fromESB response) we decide if we want page below if:
                // 1. On WEB and useDedicatedPage setting is ON
                // 2. On mobile and useDedicatedPageMobile setting is ON
                if (
                    $displayReconsent
                    &&
                    (
                        ( !ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'useDedicatedPage' ) )
                        ||
                        ( ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'useDedicatedPageMobile' ) )
                    )
                )
                {
                    CookieTool::destroyCookie( 'displayToUPPPopin' );
                    CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
                    CookieTool::setCookie( 'displayToUPPPage', 1, time() + ( 2 * 24 * 60 * 60 ) );
                    $touPpPageUrl = eZINI::instance( 'site.ini' )->variable( 'SiteSettings', 'ToUPPPageUrl' ) . "/#?tpc=" . urlencode( $loginResult['destUrl'] );
                    $redirectURL = "/loginActions.php?context=" . urlencode( $touPpPageUrl ) . "&params=" . urlencode( $encryptedParams );
                }
            }

            $this->response( $redirectURL );
        }
    }