package com.whyc.controller;
|
|
import com.whyc.dto.Response;
|
import com.whyc.pojo.db_user.User;
|
import com.whyc.service.LoginService;
|
import com.whyc.service.UserService;
|
import com.whyc.util.UserUtil;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@RequestMapping("login")
|
@RestController
|
@Api(tags = "登录")
|
public class LoginController extends BaseController{
|
|
@Autowired
|
private LoginService service;
|
@Autowired
|
private UserService userService;
|
|
@GetMapping("loginByRSA")
|
@ApiOperation(value ="登录-账号密码加密")
|
public Response loginByRSA(@RequestParam String userName, String password,String deliveredCode,HttpServletRequest request,Integer validCode){
|
return service.loginByRSA(userName,password,deliveredCode,request,validCode);
|
}
|
|
|
@PostMapping("logout")
|
@ApiOperation(value ="退出登录")
|
public void logout(){
|
service.logout();
|
}
|
|
|
|
|
@ApiOperation(value = "修改密码")
|
@GetMapping("changeSnId")
|
public Response changeSnId(@RequestParam String oldSnId,@RequestParam String newSnId){
|
User uinf= UserUtil.getUser();
|
return userService.changeSnId(uinf.getName(),oldSnId,newSnId);
|
}
|
|
@ApiOperation(value = "校验密码")
|
@GetMapping("checkSnId")
|
public Response checkSnId(@RequestParam String checksnId){
|
User uinf= UserUtil.getUser();
|
return userService.checkSnId(uinf.getName(),checksnId);
|
}
|
|
}
|