Ver Código Fonte

设置用户登录时cookie的中文编码。

zzy.zhiyuan.foxmail 8 anos atrás
pai
commit
85bfc8be13
1 arquivos alterados com 12 adições e 11 exclusões
  1. 12 11
      src/main/java/com/ekexiu/portal/service/SysService.java

+ 12 - 11
src/main/java/com/ekexiu/portal/service/SysService.java

24
import com.ekexiu.portal.dao.UserDao;
24
import com.ekexiu.portal.dao.UserDao;
25
import com.ekexiu.portal.mail.MailService;
25
import com.ekexiu.portal.mail.MailService;
26
import com.ekexiu.portal.mobile.MobilePhoneService;
26
import com.ekexiu.portal.mobile.MobilePhoneService;
27
import com.ekexiu.portal.po.Professor;
27
import com.ekexiu.portal.po.User;
28
import com.ekexiu.portal.po.User;
28
import com.ekexiu.portal.pojo.SessionUser;
29
import com.ekexiu.portal.pojo.SessionUser;
29
30
358
			"userType=result.getType()",
359
			"userType=result.getType()",
359
			"userAuth=String.valueOf(result.isAuth())",
360
			"userAuth=String.valueOf(result.isAuth())",
360
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
361
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
361
//			"userName=result.getName()" 
362
			"userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" 
362
			})
363
			})
363
	@Post
364
	@Post
364
	@Path("/regmail/{key}")
365
	@Path("/regmail/{key}")
381
				return null;
382
				return null;
382
			SessionUser ret = new SessionUser();
383
			SessionUser ret = new SessionUser();
383
			ret.setId(user.getId());
384
			ret.setId(user.getId());
384
//			if (null != this.professorDao.query(con, user.getId())) {
385
//				ret.setName(this.professorDao.query(con, user.getId()).getName());
386
//			}
385
			if (null != this.professorDao.query(con, user.getId())) {
386
				ret.setName(this.professorDao.query(con, user.getId()).getName());
387
			}
387
			ret.setMobilePhone(user.getMobilePhone());
388
			ret.setMobilePhone(user.getMobilePhone());
388
			ret.setType(user.getUserType());
389
			ret.setType(user.getUserType());
389
			ret.setEmail(user.getEmail());
390
			ret.setEmail(user.getEmail());
460
			"userType=result.getType()",
461
			"userType=result.getType()",
461
			"userAuth=String.valueOf(result.isAuth())",
462
			"userAuth=String.valueOf(result.isAuth())",
462
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
463
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
463
//			"userName=result.getName()" 
464
			"userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" 
464
			})
465
			})
465
	@Post
466
	@Post
466
	@Path("/slogin")
467
	@Path("/slogin")
471
			return null;
472
			return null;
472
		if (!mobile.equals(user.getMobilePhone()))
473
		if (!mobile.equals(user.getMobilePhone()))
473
			return null;
474
			return null;
474
//		Professor professor = this.professorDao.query(con, code);
475
		Professor professor = this.professorDao.query(con, code);
475
		SessionUser ret = new SessionUser();
476
		SessionUser ret = new SessionUser();
476
		ret.setId(code);
477
		ret.setId(code);
477
		ret.setMobilePhone(mobile);
478
		ret.setMobilePhone(mobile);
478
		ret.setType(user.getUserType());
479
		ret.setType(user.getUserType());
479
		ret.setEmail(user.getEmail());
480
		ret.setEmail(user.getEmail());
480
//		ret.setName(professor.getName());
481
		ret.setName(professor.getName());
481
		ret.setAuth(!DEFAULT_PASS_WORD.equals(user.getPasswd()));
482
		ret.setAuth(!DEFAULT_PASS_WORD.equals(user.getPasswd()));
482
		return ret;
483
		return ret;
483
	}
484
	}
487
			"userType=result.getType()",
488
			"userType=result.getType()",
488
			"userAuth=String.valueOf(result.isAuth())",
489
			"userAuth=String.valueOf(result.isAuth())",
489
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
490
			"userEmail=result.getEmail()==null?\"\":result.getEmail()",
490
//			"userName=result.getName()"
491
			"userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")"
491
			})
492
			})
492
	@Post
493
	@Post
493
	@Path("/login")
494
	@Path("/login")
503
504
504
		SessionUser ret = new SessionUser();
505
		SessionUser ret = new SessionUser();
505
		ret.setId(user.getId());
506
		ret.setId(user.getId());
506
//		if (null != this.professorDao.query(con, user.getId())) {
507
//			ret.setName(this.professorDao.query(con, user.getId()).getName());
508
//		}
507
		if (null != this.professorDao.query(con, user.getId())) {
508
			ret.setName(this.professorDao.query(con, user.getId()).getName());
509
		}
509
		ret.setMobilePhone(user.getMobilePhone());
510
		ret.setMobilePhone(user.getMobilePhone());
510
		ret.setType(user.getUserType());
511
		ret.setType(user.getUserType());
511
		ret.setEmail(user.getEmail());
512
		ret.setEmail(user.getEmail());