换设备重新绑定
This commit is contained in:
@@ -56,20 +56,19 @@ public class AuthService {
|
|||||||
stored = deviceId;
|
stored = deviceId;
|
||||||
log.info("[auth] first-login bind userId={} device={}", user.getId(), deviceId);
|
log.info("[auth] first-login bind userId={} device={}", user.getId(), deviceId);
|
||||||
} else if (!stored.equals(deviceId)) {
|
} else if (!stored.equals(deviceId)) {
|
||||||
if (isAdmin) {
|
// 设备指纹变化(换电脑/重装/清理注册表)会锁死账号,密码已验证通过,
|
||||||
log.warn("[auth] device mismatch but admin bypass userId={} stored={} current={}",
|
// 直接重新绑定到当前设备,避免账号被锁、数据因重建账号而丢失。
|
||||||
user.getId(), stored, deviceId);
|
loginUserMapper.update(null, new LambdaUpdateWrapper<LoginUserEntity>()
|
||||||
} else {
|
.eq(LoginUserEntity::getId, user.getId())
|
||||||
log.warn("[auth] device mismatch reject userId={} stored={} current={}",
|
.set(LoginUserEntity::getMachine, deviceId));
|
||||||
user.getId(), stored, deviceId);
|
log.warn("[auth] device rebound on login userId={} old={} new={}",
|
||||||
throw new BusinessException("当前设备与首次登录设备不一致,请在原设备上登录");
|
user.getId(), stored, deviceId);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
log.info("[auth] device match userId={} isAdmin={} device={}",
|
log.info("[auth] device match userId={} isAdmin={} device={}",
|
||||||
user.getId(), isAdmin, deviceId);
|
user.getId(), isAdmin, deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildResult(user, stored, isAdmin);
|
return buildResult(user, deviceId, isAdmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginResultVo checkLogin(String token, String currentDeviceId) {
|
public LoginResultVo checkLogin(String token, String currentDeviceId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user