Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-09 10:45:36 +02:00
parent af4be98b5b
commit 0dd3da5c01
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 16 additions and 15 deletions

View File

@ -54,10 +54,10 @@ class CustomNK15Hasher(PBKDF2PasswordHasher):
if '|' in encoded: if '|' in encoded:
salt, db_hashed_pass = encoded.split('$')[2].split('|') salt, db_hashed_pass = encoded.split('$')[2].split('|')
return OrderedDict([ return OrderedDict([
(_('algorithm'), 'custom_nk15'), (_('algorithm'), 'custom_nk15'),
(_('iterations'), '1'), (_('iterations'), '1'),
(_('salt'), mask_hash(salt)), (_('salt'), mask_hash(salt)),
(_('hash'), mask_hash(db_hashed_pass)), (_('hash'), mask_hash(db_hashed_pass)),
]) ])
return super().safe_summary(encoded) return super().safe_summary(encoded)

View File

@ -3,6 +3,7 @@
from datetime import date from datetime import date
from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
@ -11,10 +12,8 @@ from django.db.models import Q
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from member.models import Club, Membership from member.models import Club, Membership
from note.models import NoteSpecial, SpecialTransaction, MembershipTransaction, NoteUser from note.models import NoteSpecial, SpecialTransaction, MembershipTransaction, NoteUser
from wei.models import WEIClub
class Invoice(models.Model): class Invoice(models.Model):
@ -319,10 +318,8 @@ class SogeCredit(models.Model):
bde = Club.objects.get(name="BDE") bde = Club.objects.get(name="BDE")
kfet = Club.objects.get(name="Kfet") kfet = Club.objects.get(name="Kfet")
wei = WEIClub.objects.order_by('-year').first()
bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start) bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start)
kfet_qs = Membership.objects.filter(user=self.user, club=kfet, date_start__gte=kfet.membership_start) kfet_qs = Membership.objects.filter(user=self.user, club=kfet, date_start__gte=kfet.membership_start)
wei_qs = Membership.objects.filter(user=self.user, club=wei, date_start__gte=wei.membership_start)
if bde_qs.exists(): if bde_qs.exists():
m = bde_qs.get() m = bde_qs.get()
@ -334,10 +331,14 @@ class SogeCredit(models.Model):
if m.transaction not in self.transactions.all(): if m.transaction not in self.transactions.all():
self.transactions.add(m.transaction) self.transactions.add(m.transaction)
if wei_qs.exists(): if 'wei' in settings.INSTALLED_APPS:
m = wei_qs.get() from wei.models import WEIClub
if m.transaction not in self.transactions.all(): wei = WEIClub.objects.order_by('-year').first()
self.transactions.add(m.transaction) wei_qs = Membership.objects.filter(user=self.user, club=wei, date_start__gte=wei.membership_start)
if wei_qs.exists():
m = wei_qs.get()
if m.transaction not in self.transactions.all():
self.transactions.add(m.transaction)
for tr in self.transactions.all(): for tr in self.transactions.all():
tr.valid = False tr.valid = False

View File

@ -693,9 +693,9 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
self.request, "wei.change_weiregistration_information_json", self.object): self.request, "wei.change_weiregistration_information_json", self.object):
information = self.object.information information = self.object.information
d = dict( d = dict(
bus=Bus.objects.filter(pk__in=information["preferred_bus_pk"]).all(), bus=Bus.objects.filter(pk__in=information["preferred_bus_pk"]).all(),
team=BusTeam.objects.filter(pk__in=information["preferred_team_pk"]).all(), team=BusTeam.objects.filter(pk__in=information["preferred_team_pk"]).all(),
roles=WEIRole.objects.filter(pk__in=information["preferred_roles_pk"]).all(), roles=WEIRole.objects.filter(pk__in=information["preferred_roles_pk"]).all(),
) if 'preferred_bus_pk' in information else dict() ) if 'preferred_bus_pk' in information else dict()
choose_bus_form = WEIChooseBusForm( choose_bus_form = WEIChooseBusForm(
self.request.POST if self.request.POST else d self.request.POST if self.request.POST else d