1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

never option on save login notification

closes #85
This commit is contained in:
Kyle Spearrin
2017-06-13 13:59:16 -04:00
parent a598f08dce
commit 34696ed85f
8 changed files with 115 additions and 9 deletions

View File

@@ -173,6 +173,33 @@ function initUtilsService() {
return null;
}
UtilsService.prototype.getHostname = function (uriString) {
if (!uriString) {
return null;
}
uriString = uriString.trim();
if (uriString === '') {
return null;
}
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
try {
var url = new URL(uriString);
if (!url || !url.hostname) {
return null;
}
return url.hostname;
}
catch (e) {
return null;
}
}
return null;
}
function validIpAddress(ipString) {
var ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
return ipRegex.test(ipString);