Subversion Repositories SmartDukaan

Rev

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

Rev 517 Rev 555
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.Address;
6
import in.shop2020.model.v1.user.Address;
7
import in.shop2020.model.v1.user.UserContext;
7
import in.shop2020.model.v1.user.User;
8
import in.shop2020.model.v1.user.UserPrimaryInfo;
-
 
9
import in.shop2020.model.v1.user.UserState;
8
import in.shop2020.model.v1.user.UserState;
10
import in.shop2020.serving.pages.PageContentKeys;
9
import in.shop2020.serving.pages.PageContentKeys;
11
import in.shop2020.serving.pages.PageEnum;
10
import in.shop2020.serving.pages.PageEnum;
12
import in.shop2020.serving.pages.PageManager;
11
import in.shop2020.serving.pages.PageManager;
13
import in.shop2020.thrift.clients.UserContextServiceClient;
12
import in.shop2020.thrift.clients.UserContextServiceClient;
Line 185... Line 184...
185
			String password = this.reqparams.get("password")[0];
184
			String password = this.reqparams.get("password")[0];
186
			
185
			
187
			if(userClient.userExists(email)){
186
			if(userClient.userExists(email)){
188
				return false;
187
				return false;
189
			}else{
188
			}else{
190
				UserContext context = new UserContext();
-
 
191
				UserPrimaryInfo primaryInfo = new UserPrimaryInfo();
-
 
192
				UserState userState = new UserState();
189
				User user = new User();
193
				
-
 
194
				primaryInfo.setPassword(password);
190
				user.setPassword(password);
195
				primaryInfo.setEmail(email);
191
				user.setEmail(email);
196
				userState.setIsLoggedIn(true);
-
 
197
				
192
							
198
				context.setPrimaryInfo(primaryInfo);
-
 
199
				context.setUserState(userState);
-
 
200
				
-
 
201
				context = userClient.createContext(context, false);
193
				user = userClient.createUser(user);
202
				
-
 
203
				long userId = context.getId();
194
				long userId = user.getUserId();
204
				
-
 
205
				userClient.setUserAsLoggedIn(userId, (new Date()).getTime());
195
				userClient.setUserAsLoggedIn(userId, (new Date()).getTime());
206
				
196
				
207
				this.userinfo.setUserId(userId);
197
				this.userinfo.setUserId(userId);
208
				this.userinfo.setEmail(email);
198
				this.userinfo.setEmail(email);
209
				this.userinfo.setLoggedIn(true);
199
				this.userinfo.setLoggedIn(true);
Line 234... Line 224...
234
			address.setPin(pin);
224
			address.setPin(pin);
235
			address.setCountry(country);
225
			address.setCountry(country);
236
			address.setPhone(phone);
226
			address.setPhone(phone);
237
			long timestamp = (new  Date()).getTime();
227
			long timestamp = (new  Date()).getTime();
238
			
228
			
239
			if(userClient.addAddressForUser(address, userId, timestamp, false)){
229
			return userClient.addAddressForUser(userId, address, timestamp, false);			
240
				return true;
-
 
241
			} else{
-
 
242
				return false;
-
 
243
			}
-
 
244
			
-
 
245
			
230
			
246
		case 3:
231
		case 3:
247
			
232
			
248
			break;
233
			break;
249
	
234