Subversion Repositories SmartDukaan

Rev

Rev 651 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 651 Rev 762
Line 1... Line 1...
1
/**
1
/**
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
-
 
5
import in.shop2020.model.v1.user.UserContextException;
5
import in.shop2020.serving.utils.Utils;
6
import in.shop2020.serving.utils.Utils;
-
 
7
import in.shop2020.thrift.clients.UserContextServiceClient;
6
 
8
 
7
import java.io.UnsupportedEncodingException;
9
import java.io.UnsupportedEncodingException;
8
 
10
 
9
import org.apache.juli.logging.Log;
11
import org.apache.juli.logging.Log;
10
import org.apache.juli.logging.LogFactory;
12
import org.apache.juli.logging.LogFactory;
11
import org.apache.struts2.convention.annotation.Result;
13
import org.apache.struts2.convention.annotation.Result;
12
import org.apache.struts2.convention.annotation.Results;
14
import org.apache.struts2.convention.annotation.Results;
-
 
15
import org.apache.thrift.TException;
13
 
16
 
14
/**
17
/**
15
 * @author rajveer
18
 * @author rajveer
16
 *
19
 *
17
 */
20
 */
Line 41... Line 44...
41
		String email = this.request.getParameter("txtLoginID");
44
		String email = this.request.getParameter("txtLoginID");
42
		String oldPassword = this.request.getParameter("txtOldPassword");
45
		String oldPassword = this.request.getParameter("txtOldPassword");
43
		String newPassword = this.request.getParameter("txtNewPassword");
46
		String newPassword = this.request.getParameter("txtNewPassword");
44
		
47
		
45
		if(this.userinfo.isLoggedIn()){
48
		if(this.userinfo.isLoggedIn()){
46
			if(Utils.ChangePassword(userinfo.getUserId(), email, oldPassword, newPassword))
49
			if(changePassword(userinfo.getUserId(), email, oldPassword, newPassword))
47
			{
50
			{
48
				addActionMessage("Your password is updated successfully.");
51
				addActionMessage("Your password is updated successfully.");
49
				return "success";
52
				return "success";
50
			}
53
			}
51
    	}
54
    	}
Line 67... Line 70...
67
    		return "index";
70
    		return "index";
68
    	}
71
    	}
69
    	
72
    	
70
    }
73
    }
71
    
74
    
-
 
75
    
-
 
76
	public boolean changePassword(long userId, String email, String oldPassword, String newPassword) {
-
 
77
 
-
 
78
		
-
 
79
		try {
-
 
80
			UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
-
 
81
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
-
 
82
 
-
 
83
			return userClient.updatePassword(userId,oldPassword, newPassword);
-
 
84
		} catch (UserContextException e) {
-
 
85
			e.printStackTrace();
-
 
86
		} catch (TException e) {
-
 
87
			e.printStackTrace();
-
 
88
		} catch (Exception e) {
-
 
89
			e.printStackTrace();
-
 
90
		}
-
 
91
		return false;
-
 
92
	}
-
 
93
 
-
 
94
 
-
 
95
 
72
	public String getMyaccountHeaderSnippet(){
96
	public String getMyaccountHeaderSnippet(){
73
		return htmlSnippets.get("MYACCOUNT_HEADER");
97
		return htmlSnippets.get("MYACCOUNT_HEADER");
74
	}
98
	}
75
	
99
	
76
	public String getLoginDetailsSnippet(){
100
	public String getLoginDetailsSnippet(){