| | |
| | | import com.se.auth.form.LoginBody; |
| | | import com.se.auth.form.RegisterBody; |
| | | import com.se.auth.service.SysLoginService; |
| | | import com.se.common.core.utils.AesUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.se.common.core.domain.R; |
| | | import com.se.common.core.utils.JwtUtils; |
| | |
| | | @Autowired |
| | | private SysLoginService sysLoginService; |
| | | |
| | | @Value("${enableEncrypt}") |
| | | boolean enableEncrypt; |
| | | |
| | | @PostMapping("login") |
| | | public R<?> login(@RequestBody LoginBody form) { |
| | | public R<?> login(@RequestBody LoginBody form) throws Exception { |
| | | if (enableEncrypt && !StringUtils.isEmpty(form.getPassword())) { |
| | | form.setPassword(AesUtils.decrypt(form.getPassword())); |
| | | } |
| | | // 用户登录 |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); |
| | | // 获取登录token |