Subversion Repositories SmartDukaan

Rev

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

Rev 7125 Rev 7169
Line 34... Line 34...
34
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
34
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
35
        if(loginStatus != null && loginStatus.equals("TRUE")){
35
        if(loginStatus != null && loginStatus.equals("TRUE")){
36
            redirectUrl = "/home";
36
            redirectUrl = "/home";
37
            return "redirect";
37
            return "redirect";
38
        }
38
        }
-
 
39
        //Try to get the stored store id from session
39
        storeIdString = (String) request.getSession().getAttribute("STORE_ID");
40
        storeIdString = (String) request.getSession().getAttribute("STORE_ID");
40
        if(storeIdString == null || storeIdString.isEmpty()){
41
        if(storeIdString == null || storeIdString.isEmpty()){
-
 
42
            //If not found try to get the hotspotId from request
-
 
43
            //It is a bit confusing but "storeIdString" from the next line on means hotspot id
41
            storeIdString = request.getParameter("storeid");
44
            storeIdString = request.getParameter("storeid");
42
            if(storeIdString == null){
45
            if(storeIdString == null){
43
                return "authfail";
46
                return "authfail";
44
            }else{
47
            }else{
-
 
48
                //If we get the hotspot id then we fetch the store and store the store id in session to use on subsequent requests
45
                try {
49
                try {
46
                    TransactionClient tcl = new TransactionClient(); 
50
                    TransactionClient tcl = new TransactionClient(); 
47
                    HotspotStore hotSpotStore = tcl.getClient().getHotspotStore(0, storeIdString);
51
                    HotspotStore hotSpotStore = tcl.getClient().getHotspotStore(0, storeIdString);
48
                    if(!request.getParameter("hash").equals(hotSpotStore.getSalt())) {
52
                    if(!request.getParameter("hash").equals(hotSpotStore.getSalt())) {
49
                        return "authfail";
53
                        return "authfail";
Line 61... Line 65...
61
                request.getSession().setAttribute("STORE_ID", "" + storeId);
65
                request.getSession().setAttribute("STORE_ID", "" + storeId);
62
                request.getSession().setAttribute("HASH", hash);
66
                request.getSession().setAttribute("HASH", hash);
63
                request.getSession().setAttribute("CIRCLE_ID", "" + circleId);
67
                request.getSession().setAttribute("CIRCLE_ID", "" + circleId);
64
            }
68
            }
65
        } else {
69
        } else {
-
 
70
            //FIXME : This seems to be useless code
66
            storeId = Long.parseLong(storeIdString);
71
            storeId = Long.parseLong(storeIdString);
67
        }
72
        }
68
 
73
 
69
        return INDEX;
74
        return INDEX;
70
    }
75
    }