src/main/java/cn/lemon/lib/controller/LoginController.java

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package cn.lemon.lib.controller;

import cn.lemon.lib.entity.Admin;
import cn.lemon.lib.entity.Student;
import cn.lemon.lib.entity.Teacher;
import cn.lemon.lib.service.AdminService;
import cn.lemon.lib.service.MenuService;
import cn.lemon.lib.service.StudentService;
import cn.lemon.lib.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 登录
 * */
@Controller
@Slf4j
public class LoginController {

    @Autowired
    StudentService studentService;

    @Autowired
    TeacherService teacherService;

    @Autowired
    AdminService adminService;

    @Autowired
    MenuService menuService;
    /**
     * 登录页面
     * */
    @GetMapping("/login")
    public String loginIndex() {
        return "/login/index.html";
    }

    /**
     * 登录验证
     * */
    @PostMapping("/login")
    public String checkLogin(String username, String password, int type, HttpServletRequest request, HttpServletResponse response, Model model) {

        log.info("username {}, password {}, type {}", username, password, type);

        HttpSession session = request.getSession();
        Cookie cookie = new Cookie("cookie_username", "");
        model.addAttribute("error",null);
        int current = 2;
        if (type == 0) {
后面还有 63 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。