Subversion Repositories SmartDukaan

Rev

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

Rev 793 Rev 815
Line 2... Line 2...
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
import in.shop2020.model.v1.user.User;
6
import in.shop2020.model.v1.user.User;
-
 
7
import in.shop2020.serving.utils.DesEncrypter;
7
import in.shop2020.thrift.clients.UserContextServiceClient;
8
import in.shop2020.thrift.clients.UserContextServiceClient;
8
 
9
 
9
import java.io.IOException;
10
import java.io.IOException;
10
import java.util.Date;
11
import java.util.Date;
11
 
12
 
Line 32... Line 33...
32
	 * 
33
	 * 
33
	 */
34
	 */
34
	private static final long serialVersionUID = 5390035354379263121L;
35
	private static final long serialVersionUID = 5390035354379263121L;
35
 
36
 
36
	private static Log log = LogFactory.getLog(LoginController.class);
37
	private static Log log = LogFactory.getLog(LoginController.class);
-
 
38
	private DesEncrypter desEncrypter = new DesEncrypter("saholic");
37
 
39
	
38
	private String redirectUrl;
40
	private String redirectUrl;
39
 
41
 
40
	public LoginController() {
42
	public LoginController() {
41
		super();
43
		super();
42
	}
44
	}
Line 69... Line 71...
69
			password = this.request.getParameter("password");
71
			password = this.request.getParameter("password");
70
 
72
 
71
			if (email == null || password == null) {
73
			if (email == null || password == null) {
72
				return false;
74
				return false;
73
			}
75
			}
-
 
76
 
74
			log.debug(email);
77
			String encryptedPassword =   desEncrypter.encrypt(password);
75
			log.debug(password);
78
			
76
			UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
79
			UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
77
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient
80
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient
78
					.getClient();
81
					.getClient();
79
			User user = userClient.authenticateUser(email, password);
82
			User user = userClient.authenticateUser(email, encryptedPassword);
80
			userClient.setUserAsLoggedIn(user.getUserId(),(new Date()).getTime());
83
			userClient.setUserAsLoggedIn(user.getUserId(),(new Date()).getTime());
81
			String pincode = userClient.getDefaultPincode(user.getUserId());
84
			String pincode = userClient.getDefaultPincode(user.getUserId());
82
			userinfo.setUserId(user.getUserId());
85
			userinfo.setUserId(user.getUserId());
83
			userinfo.setNameOfUser(user.getName());
86
			userinfo.setNameOfUser(user.getName());
84
			userinfo.setEmail(email);
87
			userinfo.setEmail(email);