Browse Source

当前登录用户IP:

release_0.0.1
巴林闲侠 2 years ago
parent
commit
3871adf4bf
  1. 1
      api/app/lib/controllers/auth/index.js

1
api/app/lib/controllers/auth/index.js

@ -45,6 +45,7 @@ async function login (ctx, next) {
let ip = let ip =
// '117.90.39.49' || // '117.90.39.49' ||
ctx.ip ctx.ip
console.log(`当前登录用户IP:${ip}`);
if (ip && /^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$/.test(ip)) { if (ip && /^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$/.test(ip)) {
const ipLocationRes = await ctx.app.fs.godRequest.post('ip', { const ipLocationRes = await ctx.app.fs.godRequest.post('ip', {
query: { query: {

Loading…
Cancel
Save