Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions apps/home/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from jinja2 import TemplateNotFound
from apps.audit_mixin import get_remote_addr, check_user_category
from apps.authentication.forms import GroupForm
from apps.utils import update_running_labs_stats, parse_lab_expiration, datetime_from_ts, epoch_from_datetime, update_category_stats, update_stats_lab_instances_answers, utcnow, compute_lab_score, secure_filename
from apps.utils import update_running_labs_stats, parse_lab_expiration, parse_group_expiration, datetime_from_ts, epoch_from_datetime, update_category_stats, update_stats_lab_instances_answers, utcnow, compute_lab_score, secure_filename
from sqlalchemy import desc


Expand Down Expand Up @@ -1018,7 +1018,22 @@ def edit_group(group_id):

has_changes = False
for field in ["groupname", "description", "organization", "expiration", "accesstoken"]:
new_value = request.form[field] if request.form[field] else None
new_value = request.form[field] if request.form[field] else None
if field == "expiration":
try:
new_value = parse_group_expiration(new_value)
except ValueError:
current_app.logger.error(
f"Failed to update group due to invalid expiration: {new_value!r}"
)
return render_template(
"pages/groups_edit.html",
msg_fail=_("Invalid expiration date, please use the format YYYY-MM-DD."),
group=group,
action_name=action_name,
users=users_info,
return_path="home_blueprint.view_groups"
)
if getattr(group, field) != new_value:
setattr(group, field, new_value)
has_changes = True
Expand Down
4 changes: 2 additions & 2 deletions apps/templates/pages/groups_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h3 class="card-title">{{ _('General Information') }}</h3>
<label>{{ _('Expiration Date') }}</label>
<p>{{ _('The date after which this group and its resources will no longer be available. Can be used, for instance, to setup a due date for running a lab (for an exam, contest, CTF, etc). Default: never expires.') }}</p>
<div class="input-group date" id="expiredate" data-target-input="nearest">
<input name="expiration" type="text" class="form-control datetimepicker-input" data-target="#reservationdate" value="{{ group.expiration|default("", true) }}" />
<input name="expiration" type="text" class="form-control datetimepicker-input" data-target="#expiredate" placeholder="YYYY-MM-DD" value="{{ group.expiration.strftime('%Y-%m-%d') if group.expiration else "" }}" />
<div class="input-group-append" data-target="#expiredate" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
Expand Down Expand Up @@ -249,7 +249,7 @@ <h3 class="card-title">{{ _('Owners') }}</h3>
});
//Date range picker
$('#expiredate').datetimepicker({
format: 'L'
format: 'YYYY-MM-DD'
});
})
// Function to generate a random Access Token
Expand Down
Binary file modified apps/translations/en/LC_MESSAGES/messages.mo
Binary file not shown.
64 changes: 34 additions & 30 deletions apps/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-07-23 05:31-0300\n"
"POT-Creation-Date: 2026-07-23 06:11-0300\n"
"PO-Revision-Date: 2026-07-12 19:36-0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand Down Expand Up @@ -127,7 +127,7 @@ msgid "Users deleted successfully"
msgstr ""

#: apps/api/routes.py:413 apps/api/routes.py:538 apps/home/routes.py:143
#: apps/home/routes.py:995 apps/home/routes.py:1316
#: apps/home/routes.py:995 apps/home/routes.py:1331
msgid "Group not found"
msgstr ""

Expand Down Expand Up @@ -167,8 +167,8 @@ msgstr ""
#: apps/api/routes.py:473 apps/api/routes.py:508 apps/api/routes.py:906
#: apps/home/routes.py:221 apps/home/routes.py:295 apps/home/routes.py:308
#: apps/home/routes.py:387 apps/home/routes.py:472 apps/home/routes.py:501
#: apps/home/routes.py:703 apps/home/routes.py:709 apps/home/routes.py:1529
#: apps/home/routes.py:1542 apps/home/routes.py:1685
#: apps/home/routes.py:703 apps/home/routes.py:709 apps/home/routes.py:1544
#: apps/home/routes.py:1557 apps/home/routes.py:1700
msgid "Lab not found"
msgstr ""

Expand Down Expand Up @@ -219,7 +219,7 @@ msgstr ""
msgid "Invalid or Unauthorized access to lab answer"
msgstr ""

#: apps/api/routes.py:585 apps/home/routes.py:1206
#: apps/api/routes.py:585 apps/home/routes.py:1221
msgid "No Lab Answer Sheet available. Please create the Answer Sheet first."
msgstr ""

Expand Down Expand Up @@ -269,8 +269,8 @@ msgid "Thread not found"
msgstr ""

#: apps/api/routes.py:843 apps/api/routes.py:867 apps/api/routes.py:883
#: apps/api/routes.py:903 apps/api/routes.py:908 apps/home/routes.py:1531
#: apps/home/routes.py:1544 apps/home/routes.py:1650 apps/home/routes.py:1687
#: apps/api/routes.py:903 apps/api/routes.py:908 apps/home/routes.py:1546
#: apps/home/routes.py:1559 apps/home/routes.py:1665 apps/home/routes.py:1702
#: apps/templates/pages/users.html:51
msgid "Unauthorized"
msgstr ""
Expand Down Expand Up @@ -563,7 +563,7 @@ msgid "Lab saved."
msgstr ""

#: apps/home/routes.py:810 apps/home/routes.py:833 apps/home/routes.py:871
#: apps/home/routes.py:1673
#: apps/home/routes.py:1688
msgid "Not found"
msgstr ""

Expand Down Expand Up @@ -609,94 +609,98 @@ msgstr ""
msgid "Only admins can create/change System groups."
msgstr ""

#: apps/home/routes.py:1127
#: apps/home/routes.py:1031
msgid "Invalid expiration date, please use the format YYYY-MM-DD."
msgstr ""

#: apps/home/routes.py:1142
msgid "No changes were made to the group."
msgstr ""

#: apps/home/routes.py:1143
#: apps/home/routes.py:1158
msgid "Failed to update group."
msgstr ""

#: apps/home/routes.py:1156
#: apps/home/routes.py:1171
msgid "Group updated successfully"
msgstr ""

#: apps/home/routes.py:1189
#: apps/home/routes.py:1204
msgid "Invalid Lab provided for filtering."
msgstr ""

#: apps/home/routes.py:1194
#: apps/home/routes.py:1209
msgid "Invalid Group provided for filtering."
msgstr ""

#: apps/home/routes.py:1201
#: apps/home/routes.py:1216
msgid "To check with the Answer Sheet you must provide a Lab (Filter by Lab)."
msgstr ""

#: apps/home/routes.py:1248
#: apps/home/routes.py:1263
msgid "Invalid Lab provided. Please choose the Lab."
msgstr ""

#: apps/home/routes.py:1276
#: apps/home/routes.py:1291
msgid "Failed to update lab answers sheet."
msgstr ""

#: apps/home/routes.py:1282
#: apps/home/routes.py:1297
msgid "Lab answer sheet saved!"
msgstr ""

#: apps/home/routes.py:1316
#: apps/home/routes.py:1331
msgid "Error getting finished labs"
msgstr ""

#: apps/home/routes.py:1445 apps/home/routes.py:1599
#: apps/home/routes.py:1460 apps/home/routes.py:1614
msgid "No file part in the request"
msgstr ""

#: apps/home/routes.py:1449 apps/home/routes.py:1602
#: apps/home/routes.py:1464 apps/home/routes.py:1617
msgid "No file selected"
msgstr ""

#: apps/home/routes.py:1464 apps/home/routes.py:1616
#: apps/home/routes.py:1479 apps/home/routes.py:1631
#, python-format
msgid "File extension not allowed. Allowed: %(exts)s"
msgstr ""

#: apps/home/routes.py:1473
#: apps/home/routes.py:1488
#, python-format
msgid "File exceeds maximum allowed size (%(size)sMB)"
msgstr ""

#: apps/home/routes.py:1487 apps/home/routes.py:1634
#: apps/home/routes.py:1502 apps/home/routes.py:1649
msgid "Failed to save file on server"
msgstr ""

#: apps/home/routes.py:1548
#: apps/home/routes.py:1563
msgid "No uploads found"
msgstr ""

#: apps/home/routes.py:1555
#: apps/home/routes.py:1570
msgid "File not found in uploads list"
msgstr ""

#: apps/home/routes.py:1583 apps/home/routes.py:1711
#: apps/home/routes.py:1598 apps/home/routes.py:1726
msgid "Failed to update metadata"
msgstr ""

#: apps/home/routes.py:1596
#: apps/home/routes.py:1611
msgid "Invalid or missing lab id"
msgstr ""

#: apps/home/routes.py:1621
#: apps/home/routes.py:1636
#, python-format
msgid "File is too large to expose as a ConfigMap (max %(size)s KiB once encoded)"
msgstr ""

#: apps/home/routes.py:1682
#: apps/home/routes.py:1697
msgid "Invalid lab id"
msgstr ""

#: apps/home/routes.py:1693
#: apps/home/routes.py:1708
msgid "File not found in lab data list"
msgstr ""

Expand Down
Loading
Loading