Compare commits

..

27 Commits

Author SHA1 Message Date
Starthur 9c75b317eb Merge branch 'main' into translation 2022-05-17 20:29:42 +02:00
Starthur 2d2e97e794 Merge pull request 'Correcting typo' (#49) from refactor/42OAuth into main
Reviewed-on: 42CTF/website#49
2022-05-17 17:35:58 +02:00
Arthur-TRT 66ab43bf2b Correcting typo 2022-05-17 17:34:49 +02:00
Starthur 4213883774 Merge pull request 'Refactoring 42Oauth' (#48) from refactor/42OAuth into main
Reviewed-on: 42CTF/website#48
2022-05-17 15:48:05 +02:00
Arthur-TRT 9cb4b2b3a8 Refactoring 42Oauth 2022-05-17 15:29:58 +02:00
Starthur b90cc55b8d Merge pull request 'Add alt texts to base template and fr+en news' (#47) from UncleReaton/website:main into main
Reviewed-on: 42CTF/website#47
Reviewed-by: Starthur <contact+42ctf@arthur-trt.fr>
2022-05-17 14:28:19 +02:00
UncleReaton d19514f629 Add alt texts to base template and fr+en news 2022-05-11 20:43:20 +02:00
Danhia dfa36b58a6 Merge pull request 'campus_scoreboard' (#42) from campus_scoreboard into main
Reviewed-on: 42CTF/website#42
Reviewed-by: Danhia <danhia@protonmail.com>
2022-03-29 21:09:30 +02:00
Starthur bf5678d371 Merge branch 'main' into campus_scoreboard 2022-03-29 21:06:31 +02:00
Danhia 3c013794d7 Merge pull request '42OAuth' (#41) from 42OAuth into main
Reviewed-on: 42CTF/website#41
2022-03-29 21:03:47 +02:00
Danhia 6110408cd0 Merge pull request 'home-refacto' (#40) from Starthur/website:home-refacto into campus_scoreboard
Reviewed-on: 42CTF/website#40
2022-03-29 20:35:03 +02:00
Starthur bb2617a3e4 Merge branch 'home-refacto' of https://gitea.42ctf.org/Starthur/website into home-refacto 2022-03-29 19:53:10 +02:00
Starthur e23d6d7f49 HTML typo 2022-03-29 19:53:00 +02:00
Starthur 978dd24a00 Add campuses scoreboard 2022-03-29 19:53:00 +02:00
Danhia 15f3a21c60 Merge pull request 'Add 42Oauth' (#37) from Starthur/website:main into 42OAuth
Reviewed-on: 42CTF/website#37
2022-03-29 19:51:57 +02:00
Starthur e480aec493 Remove debug 2022-03-29 19:49:52 +02:00
Starthur 3991dda7d3 HTML typo 2022-03-29 18:55:54 +02:00
Starthur e8575d559e Add campuses scoreboard 2022-03-29 18:46:19 +02:00
Starthur ea691204c4 Upgrad po file 2022-03-29 16:46:03 +02:00
Arthur TROUILLET 21f38906df Change OAuth secret to env 2022-03-29 14:19:06 +02:00
Arthur TROUILLET 39e3859836 Done 2022-03-29 11:52:40 +02:00
Arthur-TRT a26784cd98 First version of 42Oauth 2022-03-29 11:02:07 +02:00
Danhia 7dad96d79f Merge pull request 'API for events data' (#33) from Danhia/website:api-events into main
Reviewed-on: 42CTF/website#33
2022-03-19 20:42:35 +01:00
Danhia d554961dd1 added API for events data 2022-03-19 20:38:52 +01:00
Danhia 280ba0d1fc Merge pull request 'Fixed a typo in resources /locale/fr' (#32) from FdB/website:fdb-patch-typo-binaires into main
Reviewed-on: 42CTF/website#32
2022-03-19 19:54:39 +01:00
Bertrand C bdd51b6cf9 Merge branch 'main' into fdb-patch-typo-binaires 2022-03-19 19:50:25 +01:00
Bertrand C c004c18e75 Fixed a typo in resources /locale/fr
Binaies to binaires
2022-03-19 19:41:47 +01:00
32 changed files with 369 additions and 62 deletions

View File

@ -1,5 +1,6 @@
from .models import UserProfileInfo
from django.contrib import admin
from .models import Campus
#admin.site.register(UserProfileInfo)
# Register your models here.
@ -7,6 +8,10 @@ from django.contrib import admin
@admin.register(UserProfileInfo)
class userprofile(admin.ModelAdmin):
#list display
list_display = ['user', 'score', 'last_submission_date']
list_display = ['user', 'score', 'last_submission_date', 'intra42_campus']
# search list
search_fields = ['score', 'user__username']
search_fields = ['score', 'user__username', 'intra42_campus']
@admin.register(Campus)
class campus(admin.ModelAdmin):
list_display = ['name']

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.11 on 2022-03-29 08:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0007_auto_20220123_1704'),
]
operations = [
migrations.AddField(
model_name='userprofileinfo',
name='intra42_campus',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='userprofileinfo',
name='intra42_id',
field=models.CharField(blank=True, max_length=20, null=True, unique=True),
),
]

View File

@ -0,0 +1,22 @@
# Generated by Django 3.2.11 on 2022-03-29 11:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0008_auto_20220329_1034'),
]
operations = [
migrations.AlterModelOptions(
name='userprofileinfo',
options={'ordering': ['-score', 'last_submission_date', 'user__username', 'intra42_campus'], 'permissions': (('view_info', 'View user info'),), 'verbose_name': 'profile', 'verbose_name_plural': 'profiles'},
),
migrations.AddField(
model_name='userprofileinfo',
name='intra42_campus_id',
field=models.CharField(blank=True, max_length=10, null=True),
),
]

View File

@ -0,0 +1,31 @@
# Generated by Django 3.2.11 on 2022-05-17 12:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_auto_20220329_1339'),
]
operations = [
migrations.CreateModel(
name='Campus',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=50)),
],
options={
'verbose_name': 'campus',
'verbose_name_plural': 'campuses',
'permissions': (('view_info', 'View user info'),),
},
),
migrations.AddField(
model_name='userprofileinfo',
name='campus',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='accounts.campus'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.11 on 2022-05-17 12:54
from django.db import migrations
from accounts.models import UserProfileInfo
from accounts.models import Campus
def migrate_campus(apps, schema_editor):
UserProfileInfo = apps.get_model('accounts', 'UserProfileInfo')
Campus = apps.get_model('accounts', 'Campus')
for user in UserProfileInfo.objects.all():
if user.intra42_campus_id:
user.campus, created = Campus.objects.get_or_create(id=user.intra42_campus_id, name=user.intra42_campus)
user.save()
class Migration(migrations.Migration):
dependencies = [
('accounts', '0010_auto_20220517_1452'),
]
operations = [
migrations.RunPython(migrate_campus),
]

View File

@ -12,15 +12,29 @@ class UserProfileInfo(models.Model):
last_submission_date = models.DateTimeField('Last Submission Date', default=timezone.now)
token = models.CharField(max_length=200, blank=True)
discord_id = models.CharField(max_length=20, null=True, blank=True, unique=True)
intra42_id = models.CharField(max_length=20, null=True, blank=True, unique=True)
campus = models.ForeignKey('Campus', on_delete=models.DO_NOTHING, null=True, blank=True)
intra42_campus = models.CharField(max_length=50, null=True, blank=True)
intra42_campus_id = models.CharField(max_length=10, null=True, blank=True)
member = models.BooleanField(default=False)
member_since = models.DateTimeField('Member since', default=timezone.now)
member_until = models.DateTimeField('Member until', default=timezone.now)
def __str__(self):
return self.user.username
class Meta:
ordering = ['-score', 'last_submission_date', 'user__username']
ordering = ['-score', 'last_submission_date', 'user__username', 'intra42_campus']
verbose_name = 'profile'
verbose_name_plural = 'profiles'
permissions = (("view_info", "View user info"),)
class Campus(models.Model):
id = models.IntegerField(primary_key=True, unique=True)
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class Meta:
verbose_name = 'campus'
verbose_name_plural = 'campuses'
permissions = (("view_info", "View user info"),)
# Create your models here.

View File

@ -60,6 +60,21 @@
</form>
{% endif %}
</div>
<div class="d-flex">
{% if user.userprofileinfo.intra42_id|length > 0 %}
<form action="{% url 'accounts:connections-disconnect-intra42' %}" method='POST'
class="form-inline p-2">
{%csrf_token%}
<button class="btn btn-dark" type="submit">{% trans "Disconnect 42" %}</button>
</form>
{% else %}
<form action="{% url 'accounts:connections-connect-intra42' %}" method='POST'
class="form-inline p-2">
{%csrf_token%}
<button class="btn btn-dark" type="submit">{% trans "Connect 42" %}</button>
</form>
{% endif %}
</div>
</div>
</div>
</div>

View File

@ -10,8 +10,11 @@ urlpatterns = [
path('edit/', views.edit, name='edit'),
path('logout/', views.out, name='out'),
path('rank/<str:token>', views.rank, name='rank'),
path('connections/connect/discord', views.connection.connect, name='connections-connect-discord'),
path('connections/connect/discord/authorize', views.connection.authorize, name='connections-connect-discord-authorize'),
path('connections/disconnect/discord', views.connection.disconnect, name='connections-disconnect-discord'),
path('connections/connect/discord', views.connection.connect_discord, name='connections-connect-discord'),
path('connections/connect/discord/authorize', views.connection.authorize_discord, name='connections-connect-discord-authorize'),
path('connections/disconnect/discord', views.connection.disconnect_discord, name='connections-disconnect-discord'),
path('connections/connect/intra42', views.connection.connect_intra42, name='connections-connect-intra42'),
path('connections/connect/intra42/authorize', views.connection.authorize_intra42, name='connections-connect-intra42-authorize'),
path('connections/disconnect/intra42', views.connection.disconnect_intra42, name='connections-disconnect-intra42'),
path('delete_account/', views.delete_account, name='delete_account'),
]

View File

@ -5,6 +5,8 @@ from django.views.defaults import bad_request
from django.urls import reverse
from django.shortcuts import redirect
from django.contrib.sites.models import Site
from accounts.models import Campus
from django.db import IntegrityError
import os
oauth = OAuth()
@ -19,20 +21,73 @@ oauth.register(
api_base_url='https://discord.com/api/'
)
oauth.register(
name='intra42',
client_id=os.getenv('OAUTH2_INTRA42_CLIENT_ID'),
client_secret=os.getenv('OAUTH2_INTRA42_CLIENT_SECRET'),
access_token_url='https://api.intra.42.fr/oauth/token',
authorize_url='https://api.intra.42.fr/oauth/authorize',
api_base_url='https://api.intra.42.fr/'
)
@login_required
@require_POST
def connect(request):
def connect_intra42(request):
if request.user.userprofileinfo.intra42_id:
return bad_request(request, "Already connected")
site = Site.objects.get_current()
redirect_uri = reverse('accounts:connections-connect-intra42-authorize')
redirect_uri = "https://" + site.domain + redirect_uri[3:] # remove language code
return oauth.intra42.authorize_redirect(request, redirect_uri)
@login_required
def authorize_intra42(request):
if request.user.userprofileinfo.intra42_id:
return bad_request(request, "Already connected")
try:
token = oauth.intra42.authorize_access_token(request)
except:
return redirect('accounts:edit')
response = oauth.intra42.get('v2/me', token=token)
response = response.json()
intra42_id = response['id']
intra42_campus = response['campus'][0]['name']
intra42_campus_id = response['campus'][0]['id']
request.user.userprofileinfo.intra42_id = intra42_id
request.user.userprofileinfo.campus, created = Campus.objects.get_or_create(id=intra42_campus_id, name=intra42_campus)
try:
request.user.userprofileinfo.save()
return redirect('accounts:edit')
except IntegrityError:
return redirect('accounts:edit')
@login_required
@require_POST
def disconnect_intra42(request):
if not request.user.userprofileinfo.intra42_id:
return bad_request(request, "Already disconnected")
request.user.userprofileinfo.intra42_id = None
request.user.userprofileinfo.intra42_campus = None
request.user.userprofileinfo.intra42_campus_id = None
request.user.userprofileinfo.campus = None
request.user.userprofileinfo.save()
return redirect('accounts:edit')
@login_required
@require_POST
def connect_discord(request):
if request.user.userprofileinfo.discord_id:
return bad_request(request, "Already connected")
site = Site.objects.get_current()
redirect_uri = reverse('accounts:connections-connect-discord-authorize')
redirect_uri = "https://" + site.domain + redirect_uri[3:] # remove language code
print(redirect_uri)
return oauth.discord.authorize_redirect(request, redirect_uri)
@login_required
def authorize(request):
def authorize_discord(request):
if request.user.userprofileinfo.discord_id:
print("Already")
return bad_request(request, "Already connected")
try:
token = oauth.discord.authorize_access_token(request)
@ -47,7 +102,7 @@ def authorize(request):
@login_required
@require_POST
def disconnect(request):
def disconnect_discord(request):
if not request.user.userprofileinfo.discord_id:
return bad_request(request, "Already disconnected")
request.user.userprofileinfo.discord_id = None

View File

@ -3,4 +3,5 @@ from . import views
urlpatterns = [
path('bot/discord', views.discord_bot, name='discord_bot'),
path('events/<str:event_slug>', views.events_data, name='events_data'),
]

View File

@ -2,6 +2,8 @@ from django.shortcuts import render
from accounts.models import UserProfileInfo
from django.http import JsonResponse
import os
from events.models import Event, Team, EventPlayer
from django.shortcuts import get_object_or_404
# Create your views here.
@ -25,3 +27,30 @@ def discord_bot(request):
rank += 1
return JsonResponse(data)
def events_data(request, event_slug):
if request.method != 'GET':
return JsonResponse({'error':'bad request'})
event_info = get_object_or_404(Event, slug=event_slug)
if event_info.password and request.GET.get('password') != event_info.password:
return JsonResponse({'error':'not authorized'})
players = EventPlayer.objects.filter(event=event_info)
data = {}
if event_info.team_size > 1:
for player in players:
if not player.team:
continue
if not player.team.name in data:
data[player.team.name] = []
data[player.team.name].append({"name": player.user.username, "score": player.score})
else:
for player in players:
data[player.user.username] = player.score
return JsonResponse(data)

@ -1 +1 @@
Subproject commit 18fac3978d21dc824bcffa2bc960aa2bf6b4abd9
Subproject commit 5c7b5995fe12c0ed1bb10f97e56ec89377c98b54

View File

@ -1,3 +1,3 @@
We're pleased to announce that 42CTF source code is now available on a self-hosted gitea <a class="footer_imgs" href="https://gitea.42ctf.org" target="_blank"><img src="/static/img/gitea_logo.png" width="30"></a><br><br>
We're pleased to announce that 42CTF source code is now available on a self-hosted gitea <a class="footer_imgs" href="https://gitea.42ctf.org" target="_blank"><img src="/static/img/gitea_logo.png" width="30" alt="Gitea logo"></a><br><br>
If you want to contribute to the platform (development or translation), you can send us a message on <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> or simply fill this <a href="https://forms.42l.fr/apps/forms/bpmyGR37AR4yHGnC">form</a> and we'll contact you !
If you want to contribute to the platform (development or translation), you can send us a message on <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30" alt="Discord logo"></a> or simply fill this <a href="https://forms.42l.fr/apps/forms/bpmyGR37AR4yHGnC">form</a> and we'll contact you !

View File

@ -5,4 +5,4 @@ We offer you three brand new challenges created by <b><a class=profile_link href
- <b><a href='https://www.42ctf.org/ctfs/web/simple_question_2'>Simple Question of Logic 2</a></b> (30 points)<br>
- <b><a href='https://www.42ctf.org/ctfs/web/simple_question_3'>Simple Question of Logic 3</a></b> (40 points)<br>
<br>
Don't forget that you can always reach out on <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> to propose new challenges !
Don't forget that you can always reach out on <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30" alt="Discord logo"></a> to propose new challenges !

View File

@ -1,3 +1,3 @@
Nous sommes heureux de vous annoncer que le code source de 42CTF est désormais disponible sur un <a class="footer_imgs" href="https://gitea.42ctf.org" target="_blank"><img src="/static/img/gitea_logo.png" width="30"></a> auto-hébergé.<br><br>
Nous sommes heureux de vous annoncer que le code source de 42CTF est désormais disponible sur un <a class="footer_imgs" href="https://gitea.42ctf.org" target="_blank"><img src="/static/img/gitea_logo.png" width="30" alt="Logo Gitea"></a> auto-hébergé.<br><br>
Si vous voulez contribuer a la plateforme (développement ou traduction), vous pouvez nous envoyer un message sur <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> ou simplement remplir ce <a href="https://forms.42l.fr/apps/forms/bpmyGR37AR4yHGnC">formulaire</a> et nous vous contacterons !
Si vous voulez contribuer a la plateforme (développement ou traduction), vous pouvez nous envoyer un message sur <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30" alt="Logo Discord"></a> ou simplement remplir ce <a href="https://forms.42l.fr/apps/forms/bpmyGR37AR4yHGnC">formulaire</a> et nous vous contacterons !

View File

@ -5,4 +5,4 @@ On vous propose trois nouveaux challenges créés par <b><a class=profile_link
- <b><a href='https://www.42ctf.org/ctfs/web/simple_question_2'>Simple Question of Logic 2</a></b> (30 points)<br>
- <b><a href='https://www.42ctf.org/ctfs/web/simple_question_3'>Simple Question of Logic 3</a></b> (40 points)<br>
<br>
N'oubliez pas que vous pouvez toujours nous contacter sur <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> pour proposer des nouveaux challenges !
N'oubliez pas que vous pouvez toujours nous contacter sur <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30" alt="Logo Discord"></a> pour proposer des nouveaux challenges !

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: 2022-02-10 19:50+0100\n"
"Last-Translator: Clément Hamada <clementhamada@pm.me>\n"
"Language-Team: \n"
@ -87,7 +87,15 @@ msgstr ""
msgid "Connect Discord"
msgstr ""
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
msgid "Disconnect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:74
msgid "Connect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -98,12 +106,12 @@ msgstr ""
msgid "Score"
msgstr "Punktzahl"
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr "Registriert seit"
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
#, fuzzy
#| msgid "Delete my account"
msgid " Delete my account"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -84,7 +84,15 @@ msgstr ""
msgid "Connect Discord"
msgstr ""
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
msgid "Disconnect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:74
msgid "Connect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -95,12 +103,12 @@ msgstr ""
msgid "Score"
msgstr ""
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr ""
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
msgid " Delete my account"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: 2022-02-09 10:55+0100\n"
"Last-Translator: Javier Uhagón (uhagontorralvojavier@gmail.com)\n"
"Language-Team: \n"
@ -88,7 +88,15 @@ msgstr ""
msgid "Connect Discord"
msgstr ""
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
msgid "Disconnect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:74
msgid "Connect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -99,12 +107,12 @@ msgstr ""
msgid "Score"
msgstr "Puntuación"
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr "Registrado desde"
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
#, fuzzy
#| msgid "Delete my account"
msgid " Delete my account"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -92,7 +92,19 @@ msgstr "Déconnecter Discord"
msgid "Connect Discord"
msgstr "Connecter Discord"
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
#, fuzzy
#| msgid "Disconnect Discord"
msgid "Disconnect 42"
msgstr "Déconnecter Discord"
#: accounts/templates/accounts/edit.html:74
#, fuzzy
#| msgid "Connect Discord"
msgid "Connect 42"
msgstr "Connecter Discord"
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -103,12 +115,12 @@ msgstr "Connecter Discord"
msgid "Score"
msgstr "Score"
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr "Inscrit depuis"
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
#, fuzzy
#| msgid "Connected accounts"
msgid " Delete my account"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -88,7 +88,15 @@ msgstr ""
msgid "Connect Discord"
msgstr ""
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
msgid "Disconnect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:74
msgid "Connect 42"
msgstr ""
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -99,12 +107,12 @@ msgstr ""
msgid "Score"
msgstr "スコア"
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr "登録日"
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
#, fuzzy
#| msgid "Delete my account"
msgid " Delete my account"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -86,7 +86,19 @@ msgstr "Отключить Discord"
msgid "Connect Discord"
msgstr "Подключить Discord"
#: accounts/templates/accounts/edit.html:70
#: accounts/templates/accounts/edit.html:68
#, fuzzy
#| msgid "Disconnect Discord"
msgid "Disconnect 42"
msgstr "Отключить Discord"
#: accounts/templates/accounts/edit.html:74
#, fuzzy
#| msgid "Connect Discord"
msgid "Connect 42"
msgstr "Подключить Discord"
#: accounts/templates/accounts/edit.html:85
#: accounts/templates/accounts/profile.html:46
#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13
#: events/templates/events/event_info.html:66
@ -97,12 +109,12 @@ msgstr "Подключить Discord"
msgid "Score"
msgstr "Счет"
#: accounts/templates/accounts/edit.html:78
#: accounts/templates/accounts/edit.html:93
#: accounts/templates/accounts/profile.html:60
msgid "Registered since"
msgstr "Зарегистрирован с"
#: accounts/templates/accounts/edit.html:84
#: accounts/templates/accounts/edit.html:99
msgid " Delete my account"
msgstr " Удалить мой аккаунт"
@ -381,7 +393,8 @@ msgstr "Событие"
msgid ""
"No translation available. Please try another language (English or French)."
msgstr ""
"Перевод недоступен. Пожалуйста, попобуй другой язык (английский или французский)."
"Перевод недоступен. Пожалуйста, попобуй другой язык (английский или "
"французский)."
#: events/templates/events/ctf_info.html:28
#: events/templates/events/event_info.html:18
@ -400,7 +413,8 @@ msgstr "Перед вводом флагов необходимо зарегис
msgid ""
"This is a team event, please create or join a team before submitting flags."
msgstr ""
"Это командное соревнование, пожалуйста, создай или вступи в команду перед тем как отправить флаги."
"Это командное соревнование, пожалуйста, создай или вступи в команду перед "
"тем как отправить флаги."
#: events/templates/events/event_info.html:9
msgid "Subscriptions is over."
@ -635,8 +649,8 @@ msgid ""
"We've emailed you instructions for setting your password. You should receive "
"the email shortly!"
msgstr ""
"Мы отправили тебе по электронной почте инструкции по установке пароля."
"Письмо будет получено совсем скоро!"
"Мы отправили тебе по электронной почте инструкции по установке пароля.Письмо "
"будет получено совсем скоро!"
#: templates/registration/password_reset_form.html:16
msgid "Reset"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: 2022-02-10 19:27+0100\n"
"Last-Translator: Clément Hamada <clementhamada@pm.me>\n"
"Language-Team: \n"
@ -255,11 +255,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -210,11 +210,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: 2022-02-09 10:55+0100\n"
"Last-Translator: Javier Uhagón (uhagontorralvojavier@gmail.com)\n"
"Language-Team: \n"
@ -244,11 +244,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -254,11 +254,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"
@ -315,7 +317,7 @@ msgid ""
"Most of the reverse challenges are ELF binaries and won't run on Mac OS or "
"Windows."
msgstr ""
"La plupart des challenges de reverse sont des binaies ELF et ne "
"La plupart des challenges de reverse sont des binaires ELF et ne "
"fonctionneront pas sur MacOS ou Windows."
#: resources/templates/resources/tools.html:25

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -248,11 +248,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-13 18:04+0100\n"
"POT-Creation-Date: 2022-03-29 16:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -212,11 +212,13 @@ msgid "What will we do with your money ?"
msgstr ""
#: resources/templates/resources/donate.html:51
#, python-format
msgid ""
"Hosting a website - and especially a CTF platform - costs money:\n"
" more precisely, it costs us <b>50 euros per month</b>.<br>\n"
" If we had <b>40 members</b> each year, it would be enough to "
"cover the hosting of 42CTF.<br>\n"
" We currently have %(nb_members)s members. <br>\n"
" With the additional money, we could for example offer prizes "
"for limited-time events, but we will update this page as soon as we reach "
"this threshold :)"

View File

@ -12,6 +12,7 @@
<th scope="col">{% trans "Rank" %}</th>
<th scope="col">{% trans "Username" %}</th>
<th scope="col">{% trans "Website" %}</th>
<th scope="col">{% trans "Campus" %}</th>
<th scope="col">{% trans "Score" %}</th>
</tr>
</thead>
@ -26,6 +27,13 @@
<a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a>
{% endif %}
</td>
<td>
{% if s.user.userprofileinfo.intra42_campus %}
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.intra42_campus %}">
{{ s.user.userprofileinfo.intra42_campus }}
</a>
{% endif %}
</td>
<td>{{ s.user.userprofileinfo.score }}</td>
</tr>
{% endfor %}

View File

@ -4,5 +4,6 @@ from . import views
app_name = "scoreboard"
urlpatterns = [
path('', views.scoreboard, name='scoreboard')
path('', views.scoreboard, name='scoreboard'),
path('campus/<str:campus>', views.campus, name='campus')
]

View File

@ -9,4 +9,11 @@ def scoreboard(request):
scores_p = paginator.get_page(page)
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
def campus(request, campus):
scores = UserProfileInfo.objects.filter(score__gt=0, intra42_campus__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username')
paginator = Paginator(scores, 20)
page = request.GET.get('page')
scores_p = paginator.get_page(page)
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
# Create your views here.

View File

@ -34,7 +34,7 @@
<header>
<!-- As a link -->
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="{% url "home" %}"><img src="{% static "img/cover.png" %}" width="110px"/></a>
<a class="navbar-brand" href="{% url "home" %}"><img src="{% static "img/cover.png" %}" width="110px" alt="42ctf logo"/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@ -112,17 +112,17 @@
<div class="row">
<div class="col-lg-4 col-12">
<a href="https://discord.gg/DwZqPpA">
<img width="250px" src="https://discordapp.com/api/guilds/606162827274616845/widget.png?style=banner2" style="margin-bottom:5px">
<img width="250px" src="https://discordapp.com/api/guilds/606162827274616845/widget.png?style=banner2" style="margin-bottom:5px" alt="42ctf discord server banner">
</a>
</div>
<div class="col-lg-1 col-6">
<a href="https://twitter.com/42ctf">
<img width="50px" src="{% static "img/twitter.png" %}">
<img width="50px" src="{% static "img/twitter.png" %}" alt="Twitter logo">
</a>
</div>
<div class="col-lg-1 col-6 middle-md">
<a href="https://fr.linkedin.com/company/42ctf">
<img width="50px" src="{% static "img/linkedin.png" %}" style="margin-bottom:5px">
<img width="50px" src="{% static "img/linkedin.png" %}" style="margin-bottom:5px" alt="Linkedin logo">
</a>
</div>
<div class="col-lg-4 col-12 bottom-md">
@ -137,7 +137,7 @@
</div>
</a> -->
<a href="https://www.paypal.com/donate/?hosted_button_id=M6YBYZ63MQGAY" target="_blank">
<img src="/static/img/paypal.png" width="250" style="margin-top: -20px;">
<img src="/static/img/paypal.png" width="250" style="margin-top: -20px;" alt="'Donate with Paypal' banner">
</a>
</div>
<div class="col-lg-2 footer-text col-sm-12">