Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
167 ashish 1
package in.shop2020.hotspot.dashbaord.server.handler;
2
 
3
import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
4
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
345 ashish 5
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
167 ashish 6
import net.customware.gwt.dispatch.server.ActionHandler;
7
import net.customware.gwt.dispatch.server.ExecutionContext;
8
import net.customware.gwt.dispatch.shared.ActionException;
9
 
10
public class AuthHandler implements ActionHandler<AuthRequest, AuthResponse>{
11
 
12
	@Override
13
	public AuthResponse execute(AuthRequest request, ExecutionContext response)
14
			throws ActionException {
15
		String userName = request.getUsername();
16
 
17
		if (userName.trim().toUpperCase().equals("SHOP2020")){
345 ashish 18
			return new AuthResponse(userName, true, " You are charming, loving and affectionate", NEXT.INBOX);
167 ashish 19
		}
345 ashish 20
 
21
		if (userName.trim().toUpperCase().equals("ADMIN")){
22
			return new AuthResponse(userName, true, " You are charming, loving and affectionate", NEXT.ADMIN);
23
		}
167 ashish 24
		else
345 ashish 25
			return new AuthResponse(userName, false, "None", NEXT.INBOX);
167 ashish 26
	}
27
 
28
	@Override
29
	public Class<AuthRequest> getActionType() {
30
 
31
		return AuthRequest.class;
32
	}
33
 
34
	@Override
35
	public void rollback(AuthRequest arg0, AuthResponse arg1,
36
			ExecutionContext arg2) throws ActionException {
37
 
38
	}
39
 
40
}