日期:2014-05-17 浏览次数:20840 次
@Controller
@RequestMapping("/admin/user")
public class AdminUserController extends BaseController {
@Autowired
private IUserService userService;
/**
* 前往列表页面
* @return
*/
@RequestMapping
public String main() {
return "user/main";
}
/**
* 登录
* @param session
* @return
*/
@RequestMapping(value = "login" ,method = RequestMethod.GET)
public String login(HttpSession session){
User user = UserUtil.getUser(session) ;
return "user/main" ;
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public Map<String,String> login (String userName,String userPass,String yzm,HttpSession session){
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(userPass) || StringUtils.isEmpty(yzm)){
retMap.put("success", "false");
retMap.put("message", "请输入完整信息");
return retMap;
}
if(!yzm.equals(session.getAttribute("code"))){
retMap.put("success", "false");
retMap.put("message", "验证码不正确");
return retMap;
}
User user = userService.getUniqueEntity("userName",userName);
if(user==null){
retMap.put("success", "false");
retMap.put("message", "用户不存在");
} else {
if(!MD5.MD5(userPass).equals(user.getUserName())){
retMap.put("success", "false");
retMap.put("message", "密码错误");
} else {
&n