Open WZDFLING opened 1 month ago
package com.smart.module.sys.web;
import com.wf.captcha.utils.CaptchaUtil; import com.smart.common.model.Result; import com.smart.common.util.DateUtils; import com.smart.common.util.IPUtils; import com.smart.common.util.MD5Utils; import com.smart.common.util.ShiroUtils; import com.smart.module.sys.entity.SysLog; import com.smart.module.sys.entity.SysUser; import com.smart.module.sys.service.SysLogService; import com.smart.module.sys.service.SysUserService; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; 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.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
/**
登录 */ @Controller @RequestMapping("/sys") public class LoginController {
@Autowired private SysUserService sysUserService; @Autowired private SysLogService sysLogService;
/**
@Async public void saveLog(){ SysLog log = new SysLog(); SysUser user = ShiroUtils.getUserEntity(); log.setUserId(user.getUserId()); log.setUsername(user.getNickname()); log.setGmtCreate(DateUtils.getTimestamp()); log.setOperation("登录"); log.setMethod(""); log.setParams(""); log.setExceptionDetail(""); log.setTime(10); log.setIp(IPUtils.getIpAddr()); log.setDeviceType((short)0); log.setLogType((short)0); sysLogService.save(log); }
/**
/**
保证用户可以正常登录,并可以修改密码