Merge branch 'feature/management' of github.com:ONLYOFFICE/DocSpace into feature/management
This commit is contained in:
commit
b61d807054
@ -252,6 +252,13 @@ public class CommonMethods
|
|||||||
//return null;
|
//return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<string>> GetHostIpsAsync()
|
||||||
|
{
|
||||||
|
var hostName = Dns.GetHostName();
|
||||||
|
var hostEntry = await Dns.GetHostEntryAsync(hostName);
|
||||||
|
return hostEntry.AddressList.Select(ip => ip.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
public bool ValidateRecaptcha(string response, RecaptchaType recaptchaType, string ip)
|
public bool ValidateRecaptcha(string response, RecaptchaType recaptchaType, string ip)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -140,13 +140,13 @@ public class SettingsController : ControllerBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var clientIP = CommonMethods.GetClientIp();
|
var currentHostIps = await CommonMethods.GetHostIpsAsync();
|
||||||
|
|
||||||
var hostIps = await Dns.GetHostAddressesAsync(model.HostName);
|
var hostIps = await Dns.GetHostAddressesAsync(model.HostName);
|
||||||
|
|
||||||
return Ok(new
|
return Ok(new
|
||||||
{
|
{
|
||||||
value = Array.IndexOf(hostIps, clientIP) > -1
|
value = currentHostIps.Any(ip => Array.IndexOf(hostIps, ip) > -1)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user