Subversion Repositories SmartDukaan

Rev

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

Rev 7264 Rev 7370
Line 13... Line 13...
13
    private String hash;
13
    private String hash;
14
    
14
    
15
    public String index()
15
    public String index()
16
    {
16
    {
17
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
17
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
-
 
18
        String role = (String) request.getSession().getAttribute("ROLE");
18
        if(loginStatus != null && loginStatus.equals("TRUE")){
19
        if(loginStatus != null && role != null && loginStatus.equals("TRUE") && role.equals("ADMIN")){
19
            return "show";
20
            return "show";
20
        }
21
        }
21
        return INDEX;
22
        return INDEX;
22
    }
23
    }
23
 
24
 
Line 39... Line 40...
39
        try {
40
        try {
40
            HelperClient hcl = new HelperClient(); 
41
            HelperClient hcl = new HelperClient(); 
41
            ReportUser user = hcl.getClient().authenticateReportUser(username, password);
42
            ReportUser user = hcl.getClient().authenticateReportUser(username, password);
42
            if (user.getRole() == -1) {
43
            if (user.getRole() == -1) {
43
                request.getSession().setAttribute("LOGGED_IN", "TRUE");
44
                request.getSession().setAttribute("LOGGED_IN", "TRUE");
-
 
45
                request.getSession().setAttribute("ROLE", "ADMIN");
44
            } else {
46
            } else {
45
                message = "Invalid Username/Password. Please try again";
47
                message = "Invalid Username/Password. Please try again";
46
                return "index";
48
                return "index";
47
            }
49
            }
48
        } catch (HelperServiceException e) {
50
        } catch (HelperServiceException e) {