Subversion Repositories SmartDukaan

Rev

Rev 2021 | Rev 2183 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2021 Rev 2157
Line 18... Line 18...
18
import java.util.Date;
18
import java.util.Date;
19
import java.util.List;
19
import java.util.List;
20
 
20
 
21
import javax.servlet.http.Cookie;
21
import javax.servlet.http.Cookie;
22
 
22
 
23
import org.apache.commons.lang.StringUtils;
-
 
24
import org.apache.log4j.Logger;
23
import org.apache.log4j.Logger;
25
import org.apache.struts2.convention.annotation.Result;
24
import org.apache.struts2.convention.annotation.Result;
26
import org.apache.struts2.convention.annotation.Results;
25
import org.apache.struts2.convention.annotation.Results;
27
 
26
 
28
/**
27
/**
Line 39... Line 38...
39
})
38
})
40
public class RegisterController extends BaseController{
39
public class RegisterController extends BaseController{
41
	
40
	
42
	private static final long serialVersionUID = 1L;
41
	private static final long serialVersionUID = 1L;
43
	private static Logger log = Logger.getLogger(Class.class);
42
	private static Logger log = Logger.getLogger(Class.class);
44
	private static Logger dataLog = DataLogger.getLogger();
-
 
45
	private DesEncrypter desEncrypter = new DesEncrypter("saholic");
43
	private DesEncrypter desEncrypter = new DesEncrypter("saholic");
46
	
44
	
47
	private String redirectUrl = null;
45
	private String redirectUrl = null;
48
 
46
 
49
	public RegisterController(){
47
	public RegisterController(){
Line 96... Line 94...
96
    		addActionError("Please enter Communication email.");
94
    		addActionError("Please enter Communication email.");
97
    		isValid = false;
95
    		isValid = false;
98
        }
96
        }
99
    	
97
    	
100
    	if(!isValid){
98
    	if(!isValid){
101
    	    dataLog.info(StringUtils.join(new String[] { Event.REGISTER_DATA_INCOMPLETE.name(),
99
    	    DataLogger.logData(Event.REGISTER_DATA_INCOMPLETE.name(), email, userName, communicationEmail);
102
                    email, userName, communicationEmail  }, ", "));
-
 
103
    		return isValid;
100
    		return isValid;
104
    	}
101
    	}
105
    	
102
    	
106
		UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
103
		UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
107
		in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
104
		in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
108
 
105
 
109
		if(userClient.userExists(email)){
106
		if(userClient.userExists(email)){
110
			addActionError("User already exists with this email id.");
107
			addActionError("User already exists with this email id.");
111
			dataLog.info(StringUtils.join(new String[] { Event.REGISTER_FAILED_USER_EXISTS.name(),
108
			DataLogger.logData(Event.REGISTER_FAILED_USER_EXISTS.name(), email, userName, communicationEmail);
112
                    email, userName, communicationEmail  }, ", "));
-
 
113
			return false;
109
			return false;
114
		}
110
		}
115
 
111
 
116
		User user = new User();
112
		User user = new User();
117
		user.setName(userName);
113
		user.setName(userName);
Line 182... Line 178...
182
		userinfo.setTotalItems(totalItems);
178
		userinfo.setTotalItems(totalItems);
183
        if (cookiesMap.containsKey(TrackingInterceptor.AFF_COOKIE)) {
179
        if (cookiesMap.containsKey(TrackingInterceptor.AFF_COOKIE)) {
184
            long affId = Long.parseLong(cookiesMap.get(TrackingInterceptor.AFF_COOKIE).getValue());
180
            long affId = Long.parseLong(cookiesMap.get(TrackingInterceptor.AFF_COOKIE).getValue());
185
            userClient.addTrackLog(affId, userId, "new registration", "",email, (new Date()).getTime());
181
            userClient.addTrackLog(affId, userId, "new registration", "",email, (new Date()).getTime());
186
        }
182
        }
187
        dataLog.info(StringUtils.join(new String[] { Event.REGISTER_SUCCESS.name(),
-
 
188
                email, userName, communicationEmail  }, ", "));
183
        DataLogger.logData(Event.REGISTER_SUCCESS.name(), email, userName, communicationEmail);
189
 
184
 
190
		return true;
185
		return true;
191
    }
186
    }
192
 
187
 
193
	public String getRegistrationHeaderSnippet(){
188
	public String getRegistrationHeaderSnippet(){