mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +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) {
|
||||
$.get(script_root + '/api/v1/'+ user_mode +'/me/solves', function (response) {
|
||||
var solves = response.data;
|
||||
if (authed) {
|
||||
$.get(script_root + '/api/v1/' + user_mode + '/me/solves', function (response) {
|
||||
var solves = response.data;
|
||||
|
||||
for (var i = solves.length - 1; i >= 0; i--) {
|
||||
var chal_id = solves[i].challenge_id;
|
||||
user_solves.push(chal_id);
|
||||
for (var i = solves.length - 1; i >= 0; i--) {
|
||||
var chal_id = solves[i].challenge_id;
|
||||
user_solves.push(chal_id);
|
||||
|
||||
}
|
||||
if (cb) {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (cb) {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
function getsolves(id) {
|
||||
@@ -276,8 +280,6 @@ function loadchals(cb) {
|
||||
$("#" + catid + "-row").find(".category-challenges > .challenges-row").append(chalwrap);
|
||||
}
|
||||
|
||||
// marksolves();
|
||||
|
||||
$('.challenge-button').click(function (e) {
|
||||
loadchal(this.value);
|
||||
getsolves(this.value);
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
{% endblock %}
|
||||
|
||||
{% 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/multi-modal.js') }}"></script>
|
||||
{% if admin or not errors %}
|
||||
|
||||
@@ -74,19 +74,19 @@
|
||||
<div class="text-center">Page
|
||||
<br>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% for page in range(1, pages + 1) %}
|
||||
{% 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 %}
|
||||
<b>{{ page }}</b>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user