|
@@ -1,17 +1,12 @@
|
|
package cn.com.qmth.examcloud.tool.controller;
|
|
package cn.com.qmth.examcloud.tool.controller;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.tool.cache.LoginSessionManager;
|
|
|
|
-import cn.com.qmth.examcloud.tool.config.Constants;
|
|
|
|
import cn.com.qmth.examcloud.tool.enums.TaskStatus;
|
|
import cn.com.qmth.examcloud.tool.enums.TaskStatus;
|
|
import cn.com.qmth.examcloud.tool.enums.TaskType;
|
|
import cn.com.qmth.examcloud.tool.enums.TaskType;
|
|
import cn.com.qmth.examcloud.tool.service.CommonService;
|
|
import cn.com.qmth.examcloud.tool.service.CommonService;
|
|
-import cn.com.qmth.examcloud.tool.vo.user.User;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
@Controller
|
|
@Controller
|
|
public class IndexController extends BaseController {
|
|
public class IndexController extends BaseController {
|
|
@@ -24,31 +19,6 @@ public class IndexController extends BaseController {
|
|
return "index";
|
|
return "index";
|
|
}
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/logout")
|
|
|
|
- public String logout() {
|
|
|
|
- User user = currentLoginUser();
|
|
|
|
- if (user != null) {
|
|
|
|
- LoginSessionManager.removeLoginSession(user.getToken());
|
|
|
|
- currentSession().removeAttribute(Constants.LOGIN_USER);
|
|
|
|
- }
|
|
|
|
- return "redirect:/login";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping(value = "/login")
|
|
|
|
- public String login() {
|
|
|
|
- if (currentLoginUser() != null) {
|
|
|
|
- return "redirect:/admin/workspace";
|
|
|
|
- }
|
|
|
|
- return "login";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @PostMapping(value = "/login")
|
|
|
|
- public void doLogin(@RequestParam String serverUrl, @RequestParam String loginName, @RequestParam String password,
|
|
|
|
- @RequestParam(required = false) String smsCode) {
|
|
|
|
- User user = commonService.login(serverUrl, loginName, password, smsCode);
|
|
|
|
- currentSession().setAttribute(Constants.LOGIN_USER, user);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@GetMapping(value = "/admin/workspace")
|
|
@GetMapping(value = "/admin/workspace")
|
|
public String workspace() {
|
|
public String workspace() {
|
|
return "admin/workspace";
|
|
return "admin/workspace";
|