diff --git a/CTFd/themes/admin/templates/config.html b/CTFd/themes/admin/templates/config.html index 1658ea02..164a9cad 100644 --- a/CTFd/themes/admin/templates/config.html +++ b/CTFd/themes/admin/templates/config.html @@ -97,8 +97,8 @@ Prevent team name changes - -
+
+
@@ -259,13 +261,13 @@
+ type='number'>
+ type='number'>
@@ -276,13 +278,13 @@
+ type='number'>
+ max="59" type='number'>
@@ -301,20 +303,20 @@
+ placeholder="End Date (Local Time)" readonly>
+ placeholder="End Date (Timezone Time)" readonly>
+ placeholder="End Date (UTC timestamp)" + {% if end is defined and end != None %}value="{{ end }}"{% endif %} readonly>
@@ -606,7 +608,6 @@ }); $(function () { - var hash = window.location.hash; if (hash) { hash = hash.replace("<>[]'\"", ""); @@ -621,8 +622,7 @@ var start = $('#start').val(); var end = $('#end').val(); var freeze = $('#freeze').val(); - console.log(start); - console.log(end); + if (start){ load_timestamp('start', start); } @@ -632,6 +632,11 @@ if (freeze) { load_timestamp('freeze', freeze); } + + // Toggle username and password based on stored value + $('#mail_useauth').change(function () { + $('#mail_username_password').toggle(this.checked); + }).change(); }); {% endblock %} diff --git a/CTFd/utils.py b/CTFd/utils.py index 2c3860ab..29e4b18e 100644 --- a/CTFd/utils.py +++ b/CTFd/utils.py @@ -437,11 +437,14 @@ def mailserver(): def get_smtp(host, port, username=None, password=None, TLS=None, SSL=None, auth=None): - smtp = smtplib.SMTP(host, port) - smtp.ehlo() + if SSL is None: + smtp = smtplib.SMTP(host, port) + else: + smtp = smtplib.SMTP_SSL(host, port) + if TLS: smtp.starttls() - smtp.ehlo() + if auth: smtp.login(username, password) return smtp