Ignore:
Timestamp:
2019-07-23T13:45:16+12:00 (5 years ago)
Author:
kjdon
Message:

made it optional whether the user gets shown the terms and conditions (verify) every time, or just once. In collectionConfig.xml, in security element, set humanVerify=once to make it show the verify page only once (per session), otherwise set to 'true' or 'always', which will show the page everytime.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java

    r33176 r33347  
    8181    /** Stores the scope of any security rules (either collection or document) */
    8282    protected boolean _securityScopeCollection = true;
    83         protected boolean _humanVerify = false;
     83        protected String _humanVerify = null;
    8484        protected boolean _useRecaptcha = false; // for human verify
    8585        protected String _siteKey = null; // for recaptcha
     
    340340
    341341        String humanVerify = securityBlock.getAttribute(GSXML.VERIFY_ATT);
    342         if (humanVerify.equals("true")) {
    343           _humanVerify = true;
     342        if (!humanVerify.equals("") && !humanVerify.equals("false")) {
     343          _humanVerify = humanVerify;
    344344        }
    345345
     
    519519        response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_SECURITY);
    520520
    521         if (_humanVerify) {
    522           response.setAttribute("humanVerify", "true");
     521        if (_humanVerify != null) {
     522          response.setAttribute("humanVerify", _humanVerify);
    523523          if (_useRecaptcha) {
    524524            response.setAttribute("siteKey", _siteKey);
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/URLFilter.java

    r33241 r33347  
    534534    // if got here have no groups that we need to belong to
    535535    // do we have human verify thing?
    536     if (verifiable_file && !securityResponse.getAttribute(GSXML.VERIFY_ATT).equals("") ) {
     536    if (verifiable_file) {
     537      String verify = securityResponse.getAttribute(GSXML.VERIFY_ATT);
     538      if (!verify.equals("")) {
    537539      // we are asking for the main document, and we have been asked to verify the user
    538540      logger.error("KATH verifiable file is true");
    539      
     541
    540542      // have we done the test previously?
    541543      boolean already_verified = false;
    542544      String hmvf_response = request.getParameter(GSParams.VERIFIED);
    543545      if (hmvf_response != null && hmvf_response.equals("0")) {
    544         // force the t&c
    545       } else {
     546        // manually force the t&c (user has added hmvf=0 to url)
     547      } else if (verify.equals("once")) {
     548        // lets check whether they have done it already
     549
    546550        if (verifiedUserMap == null) {
    547551          // we haven't done this at all, set up the map
     
    555559        }
    556560        logger.error("KATH already verified = "+already_verified);
    557          
    558         if (!already_verified) {
     561      }
     562     
     563      if (!already_verified) {
    559564          // have we just  done the test?
    560565          //String hmvf_response = request.getParameter(GSParams.VERIFIED);
     
    585590        }
    586591        already_verified = true;
    587         // store the fact that user has verified
    588         UserTimer timer = new UserTimer(verifiedUserTimeout, session_id);
    589         verifiedUserMap.put(session_id, timer);
    590         timer.start();
    591        
     592        if (verify.equals("once")) {
     593          // store the fact that user has verified
     594          UserTimer timer = new UserTimer(verifiedUserTimeout, session_id);
     595          verifiedUserMap.put(session_id, timer);
     596          timer.start();
     597        }
    592598          } // hmvf = 1
    593         }
    594       }
     599      }
     600     
    595601      if (!already_verified) {
    596602        // hmvf param is not set - we haven't shown them the form yet
     
    603609        return;
    604610      }
    605     } // end if verifiable file && need to verify
     611      } // end verify is set
     612    }// end if verifiable file
    606613   
    607614           
Note: See TracChangeset for help on using the changeset viewer.