|
|
@ -52,8 +52,8 @@ import com.huatek.torch.util.uuid.Uuid;
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public class LoginServiceImpl implements LoginService {
|
|
|
|
public class LoginServiceImpl implements LoginService {
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${dangle.dat.path}")
|
|
|
|
// @Value("${dangle.dat.path}")
|
|
|
|
private String danglePath;
|
|
|
|
// private String danglePath;
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${dangle.dat.ip}")
|
|
|
|
@Value("${dangle.dat.ip}")
|
|
|
|
private String ip;
|
|
|
|
private String ip;
|
|
|
@ -76,9 +76,9 @@ public class LoginServiceImpl implements LoginService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> login(UserDTO user, long time, String tag, String code, boolean verify) throws Exception{
|
|
|
|
public Map<String, Object> login(UserDTO user, long time, String tag, String code, boolean verify) throws Exception{
|
|
|
|
|
|
|
|
|
|
|
|
if(!verifyDongle()){
|
|
|
|
// if(!verifyDongle()){
|
|
|
|
return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null);
|
|
|
|
// return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
ValueOperations<String, String> operations = redisTemplate.opsForValue();
|
|
|
|
ValueOperations<String, String> operations = redisTemplate.opsForValue();
|
|
|
|
if (verify) {
|
|
|
|
if (verify) {
|
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
@ -137,36 +137,36 @@ public class LoginServiceImpl implements LoginService {
|
|
|
|
return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", "");
|
|
|
|
return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean verifyDongle() throws UnknownHostException {
|
|
|
|
// public boolean verifyDongle() throws UnknownHostException {
|
|
|
|
String path=danglePath;
|
|
|
|
// String path=danglePath;
|
|
|
|
File file = new File(path);
|
|
|
|
// File file = new File(path);
|
|
|
|
List list = new ArrayList();
|
|
|
|
// List list = new ArrayList();
|
|
|
|
String sourse="";
|
|
|
|
// String sourse="";
|
|
|
|
if (file.exists()) {
|
|
|
|
// if (file.exists()) {
|
|
|
|
try {
|
|
|
|
// try {
|
|
|
|
//将文件的每行为一个元素添加到list中
|
|
|
|
// //将文件的每行为一个元素添加到list中
|
|
|
|
list = Files.readAllLines(file.toPath(), Charset.defaultCharset());
|
|
|
|
// list = Files.readAllLines(file.toPath(), Charset.defaultCharset());
|
|
|
|
} catch (IOException ex) {
|
|
|
|
// } catch (IOException ex) {
|
|
|
|
ex.printStackTrace();
|
|
|
|
// ex.printStackTrace();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (list.isEmpty()){
|
|
|
|
// if (list.isEmpty()){
|
|
|
|
return false;
|
|
|
|
// return false;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
return false;
|
|
|
|
// return false;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
for (Object line : list) {
|
|
|
|
// for (Object line : list) {
|
|
|
|
sourse+=line;
|
|
|
|
// sourse+=line;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
String sourseNew =Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase();
|
|
|
|
// String sourseNew =Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase();
|
|
|
|
if(sourse.equals(sourseNew)){
|
|
|
|
// if(sourse.equals(sourseNew)){
|
|
|
|
return true;
|
|
|
|
// return true;
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
return false;
|
|
|
|
// return false;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> changePwd(String token, Map<String, String> map) {
|
|
|
|
public Map<String, Object> changePwd(String token, Map<String, String> map) {
|
|
|
|
String oldPwd = map.get("oldPwd");
|
|
|
|
String oldPwd = map.get("oldPwd");
|
|
|
|