V6.1.1 Updates

This commit is contained in:
adator
2024-12-08 23:02:36 +01:00
parent cb042a5411
commit befe452df8
9 changed files with 198 additions and 77 deletions

View File

@@ -758,7 +758,7 @@ class Base:
except TypeError:
return None
def is_valid_ip(self, ip_to_control:str) -> bool:
def is_valid_ip(self, ip_to_control: str) -> bool:
try:
if ip_to_control in self.Config.WHITELISTED_IP:
@@ -769,6 +769,26 @@ class Base:
except ValueError:
return False
def is_valid_email(self, email_to_control: str) -> bool:
"""Check if the email is valid
Args:
email_to_control (str): email to control
Returns:
bool: True is the email is correct
"""
try:
pattern = '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
if re.match(pattern, email_to_control):
return True
else:
return False
except Exception as err:
self.logs.error(f'General Error: {err}')
return False
def decode_ip(self, ip_b64encoded: str) -> Union[str, None]:
binary_ip = b64decode(ip_b64encoded)