Implement cookie acceptance when a visitor click the 'accept' button
963426
def cookie_accepted

      # Get the visitor's current page URL or, if nil?,  default to the application root. Resue block needed for bots
      visitor_current_url = begin
        cookies.signed[CookieAlert.config.cookie_name.to_sym].split(CookieAlert.config.cookie_value_text_separator)[1]
      rescue
        main_app.root_path
      end

      # Set the Cookie value to 'accepted'
      if CookieAlert.config.cookie_type == 'permanent'
 
        # Set a permanent cookie
        cookies.permanent.signed[CookieAlert.config.cookie_name.to_sym] = 'accepted'
 
      elsif CookieAlert.config.cookie_type == 'fixed_duration'
 
        # Set a fixed duration cookie
        cookies.permanent.signed[CookieAlert.config.cookie_name.to_sym] = { value: 'accepted', expires: CookieAlert.config.num_days_until_cookie_expires.days.from_now }
 
      else
 
        # Set a session cookie
        cookies.signed[CookieAlert.config.cookie_name.to_sym] = 'accepted'
 
      end
      
      # If the request is HTML then redirect the visitor back to their original page
      # If the request is javascript then render the javascript partial
      respond_to do |format|

        format.html { redirect_to(visitor_current_url) }
        format.js { render template: "cookie_alert/cookies/cookie_accepted" }

      end
  
    end
1325280
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {

		boolean loggedIn = false;
		User user = null;
		try {
			Cookie cookie = getCookieFromRequest(request);
			if( null != cookie ) {
				user = CookieAuthentication.verifyCookieString(userRepository, cookie.getValue());
				loggedIn = true;
			}
		} catch(Exception e) {
			// Ignore
		}
		
		if( null == user ) {
			user = userRepository.getDefaultUser();
		}
		
		acceptRequest(response, loggedIn, user);
	}
1079275
private void onClickAdd() {

        if (m_currentLocation.isPresent()) {
            CmsFavoriteEntry entry = m_currentLocation.get();
            List<CmsFavoriteEntry> entries = getEntries();
            entries.add(entry);
            try {
                m_favDao.saveFavorites(entries);
            } catch (Exception e) {
                CmsErrorDialog.showErrorDialog(e);
            }
            m_context.close();
        }
    }
754011
public void accept(final WebAppVisitor visitor) {
		visitor.visit(this); // First do everything else

		for (WebAppListener listener : listeners) {
			visitor.visit(listener);
		}
		if (!filters.isEmpty()) {
			// first visit the filters with a filter mapping in mapping order
			final List<WebAppFilter> remainingFilters = new ArrayList<>(
					filters.values());
			for (String filterName : orderedFilters) {
				final WebAppFilter filter = filters.get(filterName);
				visitor.visit(filter);
				remainingFilters.remove(filter);
			}
			// then visit filters without a mapping order in the order they were
			// added
			for (WebAppFilter filter : remainingFilters) {
				visitor.visit(filter);
			}
		}
		if (!servlets.isEmpty()) {
			for (WebAppServlet servlet : getSortedWebAppServlet()) {
				// Fix for PAXWEB-205
				visitor.visit(servlet);
			}
		}
		if (!constraintsMapping.isEmpty()) {
			for (WebAppConstraintMapping constraintMapping : constraintsMapping) {
				visitor.visit(constraintMapping);
			}

		}

		for (WebAppErrorPage errorPage : errorPages) {
			visitor.visit(errorPage);
		}

		visitor.end();
	}
1240387
public void accept(String key, $.Function<WebSocketConnection, ?> visitor) {
        ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key);
        if (null == connections) {
            return;
        }
        if (!connections.isEmpty()) {
            lock.lock();
            try {
                List<WebSocketConnection> toBeCleared = null;
                for (WebSocketConnection conn : connections.keySet()) {
                    if (conn.closed()) {
                        if (null == toBeCleared) {
                            toBeCleared = new ArrayList<>();
                        }
                        toBeCleared.add(conn);
                        continue;
                    }
                    visitor.apply(conn);
                }
                if (null != toBeCleared) {
                    ConcurrentMap<WebSocketConnection, WebSocketConnection> originalCopy = registry.get(key);
                    originalCopy.keySet().removeAll(toBeCleared);
                }
            } finally {
                lock.unlock();
            }
        }
    }
1073040
public void sendPermanentCookie(String name, String value) {
        context.addCookie(Cookie.builder(name, value).setMaxAge(Cookie.ONE_YEAR * 20).build());
    }
168054
public void accept(InteractionUnitVisitor visitor)
    {
        visitor.startVisit(this);
        for (InteractionUnit child : children)
        {
            child.accept(visitor);
        }
        visitor.endVisit(this);
    }
856461
def click_and_attach
      assert_exists_and_enabled
      browser = Browser.new(@browser.options.dup)
      browser.webclient.set_cookie_manager(
        @browser.webclient.get_cookie_manager
      ) # hirobumi: we do want cookies as well.

      @browser.disable_event_listener do
        rescue_status_code_exception { browser.page = @object.click }
      end

      browser
    end
1172992
function checkCookie() {

      var checkCookieValues = (document.cookie.match(/^(?:.*;)?\s*mship-previous-amount\s*=\s*([^;]+)(?:.*)?$/)||[,null])[1];

      if (checkCookieValues) {
        // Split out our return string to the two values we need
        checkCookieValues = checkCookieValues.split('?');
        var thisID = checkCookieValues[0];
        var thisBtnPos = checkCookieValues[1];

        // Remove the cookie, as the next submission will set a new one
        updateCookie(thisID, thisBtnPos, 'remove');

        // Fire off a 'removeFromBasket' event
        dataLayer_updateBasket(thisID, thisBtnPos, 'remove');
      }
    }
612443
def allow(self):
        """"""
        with self.selenium.context(self.selenium.CONTEXT_CHROME):
            self.find_primary_button().click()
1110402
function(res) {
  function addCookie(cookie) {
    try {
      cookieJar.setCookieSync(cookie, config.base_url);
    } catch (err) {
      throw err;
    }
  }

  if (Array.isArray(res.headers['set-cookie'])) {
    res.headers['set-cookie'].forEach(addCookie);
  } else {
    addCookie(res.headers['set-cookie']);
  }
}
655502
def set_cookie(self, cookie=None):
        """"""
        if cookie:
            self._cookie = cookie.encode()
        else:
            self._cookie = None
978492
@Override
    public void accept(ClientlibVisitor visitor, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent) {
        visitor.visit(this, ClientlibVisitor.VisitorMode.DEPENDS, parent);
    }
1302043
public final void accept(T value) {

        if (GATE_UPDATER.get(this) == GATE_CLOSED) {
            onDrop(value);
            return;
        }

        onAccept(value);
        onNotification();
    }
141754
def allow(self, comment, content_object, request):
        """"""
        # Tests for cookie:
        if settings.COOKIE_KEY not in request.COOKIES \
            and (settings.DISCARD_SPAM or settings.DISCARD_NO_COOKIE):
                return False
        elif settings.COOKIE_KEY not in request.COOKIES:
            comment.is_removed = True
            comment.is_public = False
            return True
        return True
502805
function initPopupForm(){
  var popUpIsAlreadyVisible = $('#ep_email_form_popup').is(":visible");
  if(!popUpIsAlreadyVisible){ // if the popup isn't already visible
    var cookieVal = pad.getPadId() + "email";
    if(cookie.getPref(cookieVal) !== "true"){ // if this user hasn't already subscribed
      askClientToEnterEmail(); // ask the client to register TODO uncomment me for a pop up
    }
  }
}
980901
def set_cookie(self, cookie):
        """"""
        c = self._cookies
        self._cookies_lock.acquire()
        try:
            if cookie.domain not in c: c[cookie.domain] = {}
            c2 = c[cookie.domain]
            if cookie.path not in c2: c2[cookie.path] = {}
            c3 = c2[cookie.path]
            c3[cookie.name] = cookie
        finally:
            self._cookies_lock.release()