Changeset 32361

Show
Ignore:
Timestamp:
23.08.2018 13:27:10 (14 months ago)
Author:
kjdon
Message:

added a new field to Param - sensitive. currently have default value, and save. if save is true, it will be saved into the tomcat session and passed through for each request. The request (with all its parameters) gets added into the page as pageRequest node. I have just noticed that password params etc are in here, so are in the page XML, and get into the javascript source - all params stored in gs.cgiParams. Don't want this so the new sensitive field is set to true for any params that we don't want to appear in the paramList in the response. sensitive is false by default.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSParams.java

    r31870 r32361  
    7373  public static final String EXPAND_CONTENTS = "ec"; 
    7474  public static final String NO_TEXT = "noText"; 
     75   
    7576    //Administration 
    7677    public static final String PASSWORD = "password"; 
     
    7879    public static final String S_NEW_PASSWORD = "s1.newPassword"; 
    7980    public static final String S_OLD_PASSWORD = "s1.oldPassword"; 
    80      
     81  public static final String S_NEW_EMAIL="s1.newEmail"; 
     82    public static final String S_NEW_USERNAME = "s1.newUsername"; 
     83    public static final String S_PREV_USERNAME = "s1.prevUsername"; 
     84 
     85  // Authentication 
     86  public static final String S_RECAPTCHA_RESPONSE = "s1.g-recaptcha-response"; 
     87  public static final String S_USERNAME = "s1.username"; 
     88  public static final String S_EMAIL = "s1.email"; 
    8189    //Facets 
    8290    public static final String S_FACETS = "s1.facets"; 
     
    129137        addParameter(NO_TEXT, false); 
    130138        addParameter(DOC_EDIT, false); 
    131         addParameter(PASSWORD, false); 
    132         addParameter(S_PASSWORD, false); 
    133         addParameter(S_NEW_PASSWORD, false); 
    134         addParameter(S_OLD_PASSWORD, false); 
    135          
     139        addParameter(PASSWORD, false, true); 
     140        addParameter(S_PASSWORD, false, true); 
     141        addParameter(S_NEW_PASSWORD, false, true); 
     142        addParameter(S_OLD_PASSWORD, false, true); 
     143        addParameter(S_RECAPTCHA_RESPONSE, false, true); 
     144        addParameter(S_USERNAME, false); 
     145        addParameter(S_EMAIL, false); 
     146        addParameter(S_NEW_USERNAME, false); 
     147        addParameter(S_PREV_USERNAME, false); 
     148        addParameter(S_NEW_EMAIL, false); 
    136149        addParameter(S_FACETS, false); 
    137150        addParameter(S_FACETS_QUERIES, false); 
     
    148161    public boolean addParameter(String name, boolean save) 
    149162    { 
    150         return addParameter(name, "", save); 
    151     } 
    152  
     163      return addParameter(name, "", save); 
     164    } 
     165 
     166  public boolean addParameter(String name, boolean save, boolean sensitive) { 
     167        if (this.param_map.containsKey(name)) 
     168        { 
     169            // already there so could not add 
     170            return false; 
     171        } 
     172        this.param_map.put(name, new Param("", save, sensitive)); 
     173        return true; 
     174  } 
    153175    public boolean addParameter(String name, String default_value, boolean save) 
    154176    { 
     
    183205    } 
    184206 
    185     private class Param 
     207  public boolean isSensitive(String name) { 
     208    Param p = this.param_map.get(name); 
     209    if (p==null) { 
     210      return false; 
     211    } 
     212    return p.sensitive; 
     213  } 
     214 
     215  private class Param 
    186216    { 
    187217 
    188218        public String default_value = null; 
    189219        public boolean save = true; 
    190  
    191         public Param(String default_value, boolean save) 
     220      public boolean sensitive = false; 
     221 
     222      public Param(String default_value, boolean save) 
    192223        { 
    193224            this.default_value = default_value; 
    194225            this.save = save; 
    195226        } 
     227 
     228      public Param(String default_value, boolean save, boolean sensitive) { 
     229            this.default_value = default_value; 
     230            this.save = save; 
     231            this.sensitive = sensitive; 
     232      } 
     233       
    196234    } 
    197235}