mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-01-12 18:44:27 +01:00
Add improvements to the TOS links and make them optional
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import json
|
||||
|
||||
from flask import url_for
|
||||
|
||||
from CTFd.constants import JinjaEnum, RawEnum
|
||||
from CTFd.utils import get_config
|
||||
|
||||
@@ -63,5 +65,19 @@ class _ConfigsWrapper:
|
||||
def theme_settings(self):
|
||||
return json.loads(get_config("theme_settings", default="null"))
|
||||
|
||||
@property
|
||||
def tos_or_privacy(self):
|
||||
tos = bool(get_config("tos_url") or get_config("tos_text"))
|
||||
privacy = bool(get_config("privacy_url") or get_config("privacy_text"))
|
||||
return tos or privacy
|
||||
|
||||
@property
|
||||
def tos_link(self):
|
||||
return get_config("tos_url", default=url_for("views.tos"))
|
||||
|
||||
@property
|
||||
def privacy_link(self):
|
||||
return get_config("privacy_url", default=url_for("views.privacy"))
|
||||
|
||||
|
||||
Configs = _ConfigsWrapper()
|
||||
|
||||
@@ -268,7 +268,9 @@ $(() => {
|
||||
theme_settings_editor.refresh();
|
||||
});
|
||||
|
||||
$("a[href='#legal']").on("shown.bs.tab", function(_e) {
|
||||
$(
|
||||
"a[href='#legal'], a[href='#tos-config'], a[href='#privacy-policy-config']"
|
||||
).on("shown.bs.tab", function(_e) {
|
||||
$("#tos-config .CodeMirror").each(function(i, el) {
|
||||
el.CodeMirror.refresh();
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -56,15 +56,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if Configs.tos_or_privacy %}
|
||||
<div class="row pt-3">
|
||||
<div class="col-md-12 text-center">
|
||||
<small class="text-muted text-center">
|
||||
By registering, you agree to the
|
||||
<a href="{{ url_for('views.privacy') }}" target="_blank">privacy policy</a>
|
||||
and <a href="{{ url_for('views.tos') }}" target="_blank">terms of service</a>
|
||||
<a href="{{ Configs.privacy_link }}" rel="noopener" target="_blank">privacy policy</a>
|
||||
and <a href="{{ Configs.tos_link }}" rel="noopener" target="_blank">terms of service</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user