Subversion Repositories SmartDukaan

Rev

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

Rev 2949 Rev 3126
Line 6... Line 6...
6
import java.util.Random;
6
import java.util.Random;
7
 
7
 
8
import in.shop2020.model.v1.user.UserContextService.Client;
8
import in.shop2020.model.v1.user.UserContextService.Client;
9
import in.shop2020.serving.controllers.BaseController;
9
import in.shop2020.serving.controllers.BaseController;
10
import in.shop2020.serving.utils.DesEncrypter;
10
import in.shop2020.serving.utils.DesEncrypter;
11
import in.shop2020.thrift.clients.HelperServiceClient;
11
import in.shop2020.thrift.clients.HelperClient;
12
import in.shop2020.thrift.clients.UserContextServiceClient;
12
import in.shop2020.thrift.clients.UserClient;
13
import in.shop2020.utils.Mail;
13
import in.shop2020.utils.Mail;
14
 
14
 
15
import org.apache.log4j.Logger;
15
import org.apache.log4j.Logger;
16
import org.apache.struts2.convention.annotation.Result;
16
import org.apache.struts2.convention.annotation.Result;
17
import org.apache.struts2.convention.annotation.Results;
17
import org.apache.struts2.convention.annotation.Results;
Line 45... Line 45...
45
		// POST /Forgot password
45
		// POST /Forgot password
46
		public String create() {
46
		public String create() {
47
	    	log.info("ForgotPasswordController.create");
47
	    	log.info("ForgotPasswordController.create");
48
	    	String emailId = request.getParameter("emailId");
48
	    	String emailId = request.getParameter("emailId");
49
	    	if(emailId != null){
49
	    	if(emailId != null){
50
	    		UserContextServiceClient userContextServiceClient;
50
	    		UserClient userContextServiceClient;
51
				try {
51
				try {
52
					userContextServiceClient = new UserContextServiceClient();
52
					userContextServiceClient = new UserClient();
53
		    		Client client = userContextServiceClient.getClient();
53
		    		Client client = userContextServiceClient.getClient();
54
		    		if(!client.userExists(emailId)){
54
		    		if(!client.userExists(emailId)){
55
		    			addActionError("Email address is not registered with us.");
55
		    			addActionError("Email address is not registered with us.");
56
		    			return "failure";
56
		    			return "failure";
57
		    		}
57
		    		}
Line 78... Line 78...
78
		
78
		
79
		private boolean mailNewPassword(String emailId, String newPassword) {
79
		private boolean mailNewPassword(String emailId, String newPassword) {
80
			List<String> toList = new ArrayList<String>();
80
			List<String> toList = new ArrayList<String>();
81
			toList.add(emailId);
81
			toList.add(emailId);
82
			
82
			
83
			HelperServiceClient helperServiceClient = null;
83
			HelperClient helperServiceClient = null;
84
			try {
84
			try {
85
				helperServiceClient = new HelperServiceClient();
85
				helperServiceClient = new HelperClient();
86
				in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
86
				in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
87
				Mail mail = new Mail();
87
				Mail mail = new Mail();
88
				mail.setSubject("Password reset request");
88
				mail.setSubject("Password reset request");
89
				mail.setTo(toList);
89
				mail.setTo(toList);
90
				mail.setData("Your new password is: " + newPassword);
90
				mail.setData("Your new password is: " + newPassword);