mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 22:44:24 +01:00
Only call load_user_solves if authed (#769)
* Only call load_user_solves if authed * Fix user.html page links
This commit is contained in:
@@ -190,18 +190,22 @@ function marksolves(cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function load_user_solves(cb) {
|
function load_user_solves(cb) {
|
||||||
$.get(script_root + '/api/v1/'+ user_mode +'/me/solves', function (response) {
|
if (authed) {
|
||||||
var solves = response.data;
|
$.get(script_root + '/api/v1/' + user_mode + '/me/solves', function (response) {
|
||||||
|
var solves = response.data;
|
||||||
|
|
||||||
for (var i = solves.length - 1; i >= 0; i--) {
|
for (var i = solves.length - 1; i >= 0; i--) {
|
||||||
var chal_id = solves[i].challenge_id;
|
var chal_id = solves[i].challenge_id;
|
||||||
user_solves.push(chal_id);
|
user_solves.push(chal_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getsolves(id) {
|
function getsolves(id) {
|
||||||
@@ -276,8 +280,6 @@ function loadchals(cb) {
|
|||||||
$("#" + catid + "-row").find(".category-challenges > .challenges-row").append(chalwrap);
|
$("#" + catid + "-row").find(".category-challenges > .challenges-row").append(chalwrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// marksolves();
|
|
||||||
|
|
||||||
$('.challenge-button').click(function (e) {
|
$('.challenge-button').click(function (e) {
|
||||||
loadchal(this.value);
|
loadchal(this.value);
|
||||||
getsolves(this.value);
|
getsolves(this.value);
|
||||||
|
|||||||
@@ -53,6 +53,9 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
<script>
|
||||||
|
var authed = {{ (id is defined) | tojson }};
|
||||||
|
</script>
|
||||||
<script src="{{ url_for('views.themes', theme=get_ctf_theme(), path='js/utils.js') }}"></script>
|
<script src="{{ url_for('views.themes', theme=get_ctf_theme(), path='js/utils.js') }}"></script>
|
||||||
<script src="{{ url_for('views.themes', theme=get_ctf_theme(), path='js/multi-modal.js') }}"></script>
|
<script src="{{ url_for('views.themes', theme=get_ctf_theme(), path='js/multi-modal.js') }}"></script>
|
||||||
{% if admin or not errors %}
|
{% if admin or not errors %}
|
||||||
|
|||||||
@@ -74,19 +74,19 @@
|
|||||||
<div class="text-center">Page
|
<div class="text-center">Page
|
||||||
<br>
|
<br>
|
||||||
{% if curr_page != 1 %}
|
{% if curr_page != 1 %}
|
||||||
<a href="{{ url_for('admin.users_listing', page=curr_page - 1) }}">
|
<a href="{{ url_for('users.listing', page=curr_page - 1) }}">
|
||||||
<<<
|
<<<
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for page in range(1, pages + 1) %}
|
{% for page in range(1, pages + 1) %}
|
||||||
{% if curr_page != page %}
|
{% if curr_page != page %}
|
||||||
<a href="{{ url_for('admin.users_listing', page=page) }}">{{ page }}</a>
|
<a href="{{ url_for('users.listing', page=page) }}">{{ page }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<b>{{ page }}</b>
|
<b>{{ page }}</b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if curr_page != pages %}
|
{% if curr_page != pages %}
|
||||||
<a href="{{ url_for('admin.users_listing', page=curr_page + 1) }}">
|
<a href="{{ url_for('users.listing', page=curr_page + 1) }}">
|
||||||
>>>
|
>>>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user