diff --git a/app/__init__.py b/app/__init__.py index 3747067..bca647e 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -5,6 +5,7 @@ from flask_sqlalchemy import SQLAlchemy as SA from flask_migrate import Migrate from authlib.flask.client import OAuth as AuthlibOAuth from sqlalchemy.exc import OperationalError +from flask_seasurf import SeaSurf # subclass SQLAlchemy to enable pool_pre_ping class SQLAlchemy(SA): @@ -18,6 +19,7 @@ from app.assets import assets app = Flask(__name__) app.config.from_object('config') app.wsgi_app = ProxyFix(app.wsgi_app) +csrf = SeaSurf(app) assets.init_app(app) diff --git a/app/static/custom/js/custom.js b/app/static/custom/js/custom.js index d30cebe..85e523d 100644 --- a/app/static/custom/js/custom.js +++ b/app/static/custom/js/custom.js @@ -145,8 +145,8 @@ function SelectElement(elementID, valueToSelect) element.value = valueToSelect; } -function enable_dns_sec(url) { - $.getJSON(url, function(data) { +function enable_dns_sec(url, csrf_token) { + $.post(url, {'_csrf_token': csrf_token}, function(data) { var modal = $("#modal_dnssec_info"); if (data['status'] == 'error'){ @@ -157,7 +157,7 @@ function enable_dns_sec(url) { //location.reload(); window.location.reload(true); } - }) + }, 'json') } function getdnssec(url, domain){ diff --git a/app/templates/admin_editaccount.html b/app/templates/admin_editaccount.html index 7a46a89..409fec4 100644 --- a/app/templates/admin_editaccount.html +++ b/app/templates/admin_editaccount.html @@ -28,6 +28,7 @@