实现登录,编写错误码,实现错误码返回json
This commit is contained in:
@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@@ -14,16 +13,16 @@ public class LoginController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/index")
|
||||
@GetMapping(value = {"index",""})
|
||||
public String toLoginPage(){
|
||||
return "login";
|
||||
}
|
||||
|
||||
@PostMapping("/login/dologin")
|
||||
public boolean doLogin(TbUser tbUser){
|
||||
public String doLogin(TbUser tbUser)throws Exception{
|
||||
if (userService.doLoginService(tbUser.getColname(),tbUser.getColpassword())){
|
||||
return true;
|
||||
return "home";
|
||||
}
|
||||
return false;
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user