X-SYS
{% endcomment %} +
+ Get started
+Already have an account? Login
+diff --git a/Dashboard/__pycache__/views.cpython-310.pyc b/Dashboard/__pycache__/views.cpython-310.pyc index 4b43e1d..2b96af5 100644 Binary files a/Dashboard/__pycache__/views.cpython-310.pyc and b/Dashboard/__pycache__/views.cpython-310.pyc differ diff --git a/Dashboard/views.py b/Dashboard/views.py index 3c99126..aa09ab6 100644 --- a/Dashboard/views.py +++ b/Dashboard/views.py @@ -1633,9 +1633,38 @@ class SqlStatusView(APIView): #=============================================================================== +# from django.http import JsonResponse +# import boto3 +# from botocore.exceptions import NoCredentialsError + +# def sql_status_info(request): +# space_name = 'ddos' +# object_key = 'mysql.log' +# aws_access_key_id = 'DO00A4LNJKM8FZ4PVRD4' +# aws_secret_access_key = 'zc22Pm7xmG5pfSHl5aHbyhdYHMJAN1sIRV7+/ZzLVPo' +# endpoint_url = 'https://li-phy.sfo3.digitaloceanspaces.com' + +# s3 = boto3.client('s3', +# aws_access_key_id=aws_access_key_id, +# aws_secret_access_key=aws_secret_access_key, +# region_name='sfo3', +# endpoint_url=endpoint_url) + +# try: +# mysql = s3.get_object(Bucket=space_name, Key=object_key)['Body'].read().decode('utf-8') +# status = 'success' +# except NoCredentialsError as e: +# mysql = f"Error fetching mysql.log data: {str(e)}" +# status = 'error' + +# response_data = { +# 'mysql': mysql, +# } + +# return JsonResponse(response_data) from django.http import JsonResponse import boto3 -from botocore.exceptions import NoCredentialsError +from botocore.exceptions import NoCredentialsError, ClientError def sql_status_info(request): space_name = 'ddos' @@ -1651,13 +1680,25 @@ def sql_status_info(request): endpoint_url=endpoint_url) try: - mysql = s3.get_object(Bucket=space_name, Key=object_key)['Body'].read().decode('utf-8') + response = s3.get_object(Bucket=space_name, Key=object_key) + mysql = response['Body'].read().decode('utf-8') status = 'success' - except NoCredentialsError as e: - mysql = f"Error fetching mysql.log data: {str(e)}" + except NoCredentialsError: + mysql = "No credentials provided or invalid credentials." + status = 'error' + except ClientError as e: + error_code = e.response['Error']['Code'] + if error_code == 'AccessDenied': + mysql = "Access denied to the object. Check bucket policies and API key permissions." + else: + mysql = f"Unexpected error: {error_code}" + status = 'error' + except Exception as e: + mysql = f"An unknown error occurred: {str(e)}" status = 'error' response_data = { + 'status': status, 'mysql': mysql, } diff --git a/templates/accounts/loginwithAdd.html b/templates/accounts/loginwithAdd.html index 3ba1490..b559cac 100644 --- a/templates/accounts/loginwithAdd.html +++ b/templates/accounts/loginwithAdd.html @@ -229,7 +229,7 @@ function registerUser(formData) { $.ajax({ type: "POST", - url: "{% url 'Login_with_Device' %}", + url: "{% url 'Login_with_Device %}", data: formData, dataType: 'json', headers: { diff --git a/templates/accounts/signup1.html b/templates/accounts/signup1.html new file mode 100644 index 0000000..f4e4555 --- /dev/null +++ b/templates/accounts/signup1.html @@ -0,0 +1,132 @@ +{% load static %} + + +
+ +
+ Already have an account? Login
+
+ Already have an account? Login
+