mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-02-24 17:11:18 +00:00
Compare commits
4 Commits
391f3bde8f
...
b27341009e
Author | SHA1 | Date | |
---|---|---|---|
b27341009e | |||
da1e15c5e6 | |||
4b03a78ad6 | |||
fb6e3c3de0 |
@ -61,6 +61,12 @@ def pre_save_object(sender, instance, **kwargs):
|
|||||||
# If the field wasn't modified, no need to check the permissions
|
# If the field wasn't modified, no need to check the permissions
|
||||||
if old_value == new_value:
|
if old_value == new_value:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if app_label == 'auth' and model_name == 'user' and field.name == 'password' and request.user.is_anonymous:
|
||||||
|
# We must ignore password changes from anonymous users since it can be done by people that forgot
|
||||||
|
# their password. We trust password change form.
|
||||||
|
continue
|
||||||
|
|
||||||
if not PermissionBackend.check_perm(request, app_label + ".change_" + model_name + "_" + field_name,
|
if not PermissionBackend.check_perm(request, app_label + ".change_" + model_name + "_" + field_name,
|
||||||
instance):
|
instance):
|
||||||
raise PermissionDenied(
|
raise PermissionDenied(
|
||||||
|
@ -85,6 +85,9 @@ class UserCreateView(CreateView):
|
|||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
|
# Direct access to validation menu if we have the right to validate it
|
||||||
|
if PermissionBackend.check_perm(self.request, 'auth.view_user', self.object):
|
||||||
|
return reverse_lazy('registration:future_user_detail', args=(self.object.pk,))
|
||||||
return reverse_lazy('registration:email_validation_sent')
|
return reverse_lazy('registration:email_validation_sent')
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,3 +372,11 @@ class WEIMembership(Membership):
|
|||||||
|
|
||||||
soge_credit.update_transactions()
|
soge_credit.update_transactions()
|
||||||
soge_credit.save()
|
soge_credit.save()
|
||||||
|
|
||||||
|
if soge_credit.valid and \
|
||||||
|
soge_credit.credit_transaction.total != sum(tr.total for tr in soge_credit.transactions.all()):
|
||||||
|
# The credit is already validated, but we add a new transaction (eg. for the WEI).
|
||||||
|
# Then we invalidate the transaction, update the credit transaction amount
|
||||||
|
# and re-validate the credit.
|
||||||
|
soge_credit.validate(True)
|
||||||
|
soge_credit.save()
|
||||||
|
@ -99,9 +99,12 @@ class WEIRegistrationTable(tables.Table):
|
|||||||
|
|
||||||
url = reverse_lazy('wei:validate_registration', args=(record.pk,))
|
url = reverse_lazy('wei:validate_registration', args=(record.pk,))
|
||||||
text = _('Validate')
|
text = _('Validate')
|
||||||
if record.fee > record.user.note.balance:
|
if record.fee > record.user.note.balance and not record.soge_credit:
|
||||||
btn_class = 'btn-secondary'
|
btn_class = 'btn-secondary'
|
||||||
tooltip = _("The user does not have enough money.")
|
tooltip = _("The user does not have enough money.")
|
||||||
|
elif record.first_year and 'selected_bus_pk' not in record.information:
|
||||||
|
btn_class = 'btn-info'
|
||||||
|
tooltip = _("The user is in first year, and the repartition algorithm didn't run.")
|
||||||
else:
|
else:
|
||||||
btn_class = 'btn-success'
|
btn_class = 'btn-success'
|
||||||
tooltip = _("The user has enough money, you can validate the registration.")
|
tooltip = _("The user has enough money, you can validate the registration.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user