Merge branch 'feature/management' of github.com:ONLYOFFICE/DocSpace into feature/management

This commit is contained in:
DmitrySychugov 2023-08-24 13:07:16 +05:00
commit b61d807054
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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)
}); });
} }