package com.lightinit.hsdataportal.controller;

import com.lightinit.hsdataportal.common.ConfigUtils;
import com.lightinit.hsdataportal.common.SysContants;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * @author WangYao
 * @date 2018/6/22 11:08
 * @description 登录控制器
 */
@Controller
public class LoginController {

    @RequestMapping(value = "/login.htm")
    public String login(){
        String redirectLoginUrl = ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.REDIRECT_LOGIN_URL);
        if (StringUtils.isEmpty(redirectLoginUrl)){
            redirectLoginUrl = InternalResourceViewResolver.REDIRECT_URL_PREFIX + "/open/";
        }else {
            redirectLoginUrl = InternalResourceViewResolver.REDIRECT_URL_PREFIX + redirectLoginUrl;
        }
        return redirectLoginUrl;
    }
}
