Search in sources :

Example 1 with VisitorVo

use of com.baidu.disconf.web.service.user.vo.VisitorVo in project disconf by knightliao.

the class UserMgrImpl method getCurVisitor.

@Override
public VisitorVo getCurVisitor() {
    Visitor visitor = ThreadContext.getSessionVisitor();
    if (visitor == null) {
        return null;
    }
    VisitorVo visitorVo = new VisitorVo();
    visitorVo.setId(visitor.getId());
    visitorVo.setName(visitor.getLoginUserName());
    return visitorVo;
}
Also used : Visitor(com.baidu.disconf.web.service.user.dto.Visitor) VisitorVo(com.baidu.disconf.web.service.user.vo.VisitorVo)

Example 2 with VisitorVo

use of com.baidu.disconf.web.service.user.vo.VisitorVo 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);
}
Also used : User(com.baidu.disconf.web.service.user.bo.User) VisitorVo(com.baidu.disconf.web.service.user.vo.VisitorVo) NoAuth(com.baidu.dsp.common.annotation.NoAuth) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

VisitorVo (com.baidu.disconf.web.service.user.vo.VisitorVo)2 User (com.baidu.disconf.web.service.user.bo.User)1 Visitor (com.baidu.disconf.web.service.user.dto.Visitor)1 NoAuth (com.baidu.dsp.common.annotation.NoAuth)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1