use of com.ruoyi.iot.model.login.LoginIdValue in project wumei-smart by kerwincui.
the class SocialLoginServiceImpl method socialLogin.
@Override
public AjaxResult socialLogin(String loginId) {
AjaxResult ajax = AjaxResult.success();
String loginKey = LOGIN_SOCIAL_REDIS_KEY + loginId;
LoginIdValue loginIdValue = redisCache.getCacheObject(loginKey);
if (loginIdValue != null) {
// login
String token = sysLoginService.redirectLogin(loginIdValue.getUsername(), loginIdValue.getPassword());
ajax.put(Constants.TOKEN, token);
} else {
log.info("loginId:{} ", loginId);
return error(NO_MESSAGE_ALERT, "数据错误");
}
return ajax;
}
use of com.ruoyi.iot.model.login.LoginIdValue in project wumei-smart by kerwincui.
the class SocialLoginServiceImpl method genLoginId.
private String genLoginId(SysUser sysUser) {
String loginId = Md5Utils.hash(sysUser.getUserId() + RandomUtil.randomString(32));
String key = LOGIN_SOCIAL_REDIS_KEY + loginId;
LoginIdValue loginIdValue = new LoginIdValue();
loginIdValue.setPassword(sysUser.getPassword());
loginIdValue.setUsername(sysUser.getUserName());
redisCache.setCacheObject(key, loginIdValue, LOGIN_SOCIAL_EXPIRE_TIME, TimeUnit.SECONDS);
return loginId;
}
Aggregations