Changeset 14331


Ignore:
Timestamp:
2007-08-07T14:51:40+12:00 (15 years ago)
Author:
qq6
Message:

create an etc dir under the site if the etc is not exiting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/service/Authentication.java

    r14295 r14331  
    66import org.greenstone.gsdl3.util.UserQueryResult;
    77import org.greenstone.gsdl3.util.UserTermInfo;
     8import org.greenstone.gsdl3.util.GlobalProperties;
    89
    910import org.w3c.dom.Element;
     
    1920import org.apache.log4j.*;
    2021
    21 import org.greenstone.gsdl3.util.GSXML;
    22 import org.greenstone.gsdl3.util.GSPath;
    23 import org.greenstone.gsdl3.util.GlobalProperties;
    24 import org.greenstone.gsdl3.util.UserQueryResult;
    25 
    2622import java.net.InetAddress;
     23import java.net.URLEncoder;
    2724import java.util.Properties;
    2825import java.util.Date;
    2926import java.util.regex.Pattern;
    3027import java.io.File;
    31 
     28import java.io.UnsupportedEncodingException;
    3229//import javax.mail.*;
    3330//import javax.mail.internet.*;
     
    3835
    3936import org.apache.log4j.*;
    40 
    41 import org.greenstone.gsdl3.util.DerbyWrapper;
    42 
    4337
    4438public class Authentication
     
    10296    }
    10397 
    104     protected Element processAuthentication(Element request) throws SQLException{
     98    protected Element processAuthentication(Element request) throws SQLException, UnsupportedEncodingException{
    10599
    106100    // Create a new (empty) result message
     
    144138
    145139        if (p_name.equals("aup")){
    146         aup = p_value;
     140        aup = URLEncoder.encode(p_value,"UTF-8");
    147141        }else if (p_name.equals("un")) {
    148         un = p_value;
     142        un = URLEncoder.encode(p_value,"UTF-8");
    149143        }else if(p_name.equals("pw")) {
    150         pw = p_value;
     144        pw = URLEncoder.encode(p_value,"UTF-8");
    151145        }else if(p_name.equals("umun")) {
    152         umun = p_value;
     146        umun = URLEncoder.encode(p_value,"UTF-8");
    153147        }else if(p_name.equals("umpw")) {
    154         umpw = p_value;
     148        umpw = URLEncoder.encode(p_value,"UTF-8");
    155149        }else if (p_name.equals("umas")){
    156         umas=p_value;
     150        umas = URLEncoder.encode(p_value,"UTF-8");
    157151        }else if (p_name.equals("umgp")){
    158         umgp=p_value;
     152        umgp = URLEncoder.encode(p_value,"UTF-8");
    159153        }else if (p_name.equals("umc")){
    160         umc=p_value;
     154        umc = URLEncoder.encode(p_value,"UTF-8");
    161155        }else if (p_name.equals("asn")){
    162         asn=p_value;
     156        asn = URLEncoder.encode(p_value,"UTF-8");
    163157        }else if (p_name.equals("uan")){
    164         uan=p_value;
     158        uan = URLEncoder.encode(p_value,"UTF-8");
    165159        }else if (p_name.equals("cm")){
    166         cm=p_value;
     160        cm = URLEncoder.encode(p_value,"UTF-8");
    167161        }else if(p_name.equals("umpw1")) {
    168         umpw1 = p_value;
     162        umpw1 = URLEncoder.encode(p_value,"UTF-8");
    169163        }else if(p_name.equals("umpw2")) {
    170         umpw2 = p_value;
     164        umpw2 = URLEncoder.encode(p_value,"UTF-8");
    171165        }else if(p_name.equals("oumun")) {
    172         oumun = p_value;
     166        oumun = URLEncoder.encode(p_value,"UTF-8");
    173167        }
    174168       
     
    191185    File usersDB_file =new File(usersDB_dir);
    192186    if (!usersDB_file.exists()){
     187        String etc_dir = this.site_home + File.separatorChar + "etc";
     188        File etc_file =new File(etc_dir);
     189        if (!etc_file.exists()){
     190        boolean success = etc_file.mkdir();
     191        if (!success){
     192            logger.error("Couldn't create the etc dir under "+this.site_home + ".");
     193            return result;
     194        }
     195        }
    193196        derbyWrapper.connectDatabase(usersDB_dir,true);
    194197        derbyWrapper.createDatabase();
Note: See TracChangeset for help on using the changeset viewer.