IndexController.java 1.01 KB
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package pwc.taxtech.atms.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class IndexController {

    @RequestMapping(value = { "/", "/index", "/index.html" }, method = RequestMethod.GET)
    public String login(@CookieValue(value = "AtmsApiToken", required = false) String atmsApiToken) {
        if (StringUtils.hasText(atmsApiToken)) {
            return "index";
        }
        return "redirect:Account/LogOn";
    }

21 22 23 24 25 26 27 28
    @RequestMapping(value = {"/admin", "/admin.html" }, method = RequestMethod.GET)
    public String admin(@CookieValue(value = "AtmsApiToken", required = false) String atmsApiToken) {
        if (StringUtils.hasText(atmsApiToken)) {
            return "admin";
        }
        return "redirect:Account/LogOn";
    }

eddie.woo's avatar
eddie.woo committed
29
}