|
|
|
@ -0,0 +1,82 @@
|
|
|
|
|
package top.ezzd.controller;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
import top.ezzd.pojo.User;
|
|
|
|
|
import top.ezzd.service.UserForgetService;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
public class UserForgetController {
|
|
|
|
|
@Resource
|
|
|
|
|
private UserForgetService UserForgetServiceImpl;
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>֤<EFBFBD>û<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param uname
|
|
|
|
|
* @param session
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping("selectData")
|
|
|
|
|
public String selectData(String uname,HttpSession session) {
|
|
|
|
|
User u = UserForgetServiceImpl.selectData(uname);
|
|
|
|
|
if (u != null) {
|
|
|
|
|
session.setAttribute("uname", uname);
|
|
|
|
|
return "1";
|
|
|
|
|
} else {
|
|
|
|
|
return "2";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param u
|
|
|
|
|
* @param req
|
|
|
|
|
* @param session
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping("restPassword")
|
|
|
|
|
public String updateRestPassword(User u,HttpServletRequest req,HttpSession session){
|
|
|
|
|
String uname = (String)session.getAttribute("uname");
|
|
|
|
|
if(uname==null){
|
|
|
|
|
return "3";
|
|
|
|
|
}
|
|
|
|
|
u.setUname(uname);
|
|
|
|
|
int index = UserForgetServiceImpl.updateRestPassword(u);
|
|
|
|
|
|
|
|
|
|
if(index>0){
|
|
|
|
|
session.invalidate();
|
|
|
|
|
return "1";
|
|
|
|
|
}else{
|
|
|
|
|
session.invalidate();
|
|
|
|
|
return "2";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>
|
|
|
|
|
* @param session
|
|
|
|
|
* @param req
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("verifyData")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String verifyData(HttpSession session,HttpServletRequest req){
|
|
|
|
|
String uyzm = req.getParameter("uyzm");
|
|
|
|
|
String yzm = (String) session.getAttribute("restCode");
|
|
|
|
|
if(yzm!=null&&uyzm!=null){
|
|
|
|
|
if(uyzm.equals(yzm)){
|
|
|
|
|
session.removeAttribute("restCode");
|
|
|
|
|
return "1";
|
|
|
|
|
}else{
|
|
|
|
|
return "0";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return "0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|