use of com.baidu.disconf.web.service.user.bo.User in project disconf by knightliao.
the class UserController method signin.
/**
* 登录
*
* @param signin
* @param request
*
* @return
*/
@NoAuth
@RequestMapping(value = "/signin", method = RequestMethod.POST)
@ResponseBody
public JsonObjectBase signin(@Valid SigninForm signin, HttpServletRequest request) {
LOG.info(signin.toString());
// 验证
authValidator.validateLogin(signin);
// 数据库登录
User user = signMgr.signin(signin.getName());
// 过期时间
int expireTime = LoginConstant.SESSION_EXPIRE_TIME;
if (signin.getRemember().equals(1)) {
expireTime = LoginConstant.SESSION_EXPIRE_TIME2;
}
// redis login
redisLogin.login(request, user, expireTime);
VisitorVo visitorVo = userMgr.getCurVisitor();
return buildSuccess("visitor", visitorVo);
}
use of com.baidu.disconf.web.service.user.bo.User in project disconf by knightliao.
the class RedisLoginImplMock method isLogin.
/**
* 校验Redis是否登录
*/
@Override
public Visitor isLogin(HttpServletRequest request) {
Long userId = 1L;
User user = userMgr.getUser(userId);
Visitor visitor = new Visitor();
visitor.setId(userId);
visitor.setLoginUserId(userId);
visitor.setLoginUserName(user.getName());
return visitor;
}
use of com.baidu.disconf.web.service.user.bo.User in project disconf by knightliao.
the class AuthValidator method validatePasswordModify.
/**
* 验证密码更新
*/
public void validatePasswordModify(PasswordModifyForm passwordModifyForm) {
Visitor visitor = ThreadContext.getSessionVisitor();
User user = userMgr.getUser(visitor.getLoginUserId());
// 校验密码
if (!signMgr.validate(user.getPassword(), passwordModifyForm.getOld_password())) {
throw new FieldException(PasswordModifyForm.OLD_PASSWORD, "password.not.right", null);
}
if (!passwordModifyForm.getNew_password().equals(passwordModifyForm.getNew_password_2())) {
throw new FieldException(PasswordModifyForm.NEW_PASSWORD, "two.password.not.equal", null);
}
}
use of com.baidu.disconf.web.service.user.bo.User in project disconf by knightliao.
the class SignMgrImpl method signin.
/**
* 登录
*/
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public User signin(String phone) {
//
// 获取用户
//
User user = userDao.getUserByName(phone);
userDao.update(user);
return user;
}
use of com.baidu.disconf.web.service.user.bo.User in project disconf by knightliao.
the class UserMgrImpl method addOneAppForUser.
/**
* @param userId
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public String addOneAppForUser(Long userId, int appId) {
User user = getUser(userId);
String ownAppIds = user.getOwnApps();
if (ownAppIds.contains(",")) {
ownAppIds = ownAppIds + "," + appId;
} else {
ownAppIds = String.valueOf(appId);
}
user.setOwnApps(ownAppIds);
userDao.update(user);
return ownAppIds;
}
Aggregations