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
3 changes: 1 addition & 2 deletions src/ephios/core/forms/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ def save(self, commit=True):
Q(id__in=self.cleaned_data["groups"]) | Q(id__in=(g.id for g in self.locked_groups))
)
)
# if the user is re-activated after the email has been deemed invalid, reset the flag
if userprofile.is_active and userprofile.email_invalid:
if "email" in self.changed_data:
Comment thread
jeriox marked this conversation as resolved.
userprofile.email_invalid = False
userprofile.save()
return userprofile
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.2.13 on 2026-04-20 19:46

from django.db import migrations, models

import ephios.extra.json


class Migration(migrations.Migration):
dependencies = [
("core", "0038_eventtype_default_description"),
]

operations = [
migrations.AlterField(
model_name="userprofile",
name="disabled_notifications",
field=models.JSONField(
blank=True,
decoder=ephios.extra.json.CustomJSONDecoder,
default=list,
encoder=ephios.extra.json.CustomJSONEncoder,
),
),
]
2 changes: 1 addition & 1 deletion src/ephios/core/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class UserProfile(guardian.mixins.GuardianUserMixin, PermissionsMixin, AbstractB
choices=settings.LANGUAGES,
)
disabled_notifications = JSONField(
default=list, encoder=CustomJSONEncoder, decoder=CustomJSONDecoder
Comment thread
jeriox marked this conversation as resolved.
default=list, encoder=CustomJSONEncoder, decoder=CustomJSONDecoder, blank=True
)

USERNAME_FIELD = "email"
Expand Down
2 changes: 1 addition & 1 deletion src/ephios/core/services/notifications/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def should_send(cls, notification):
def user_prefers_sending(cls, notification):
if not notification.user:
return True
if not notification.user.is_active or notification.user.email_invalid:
Comment thread
jeriox marked this conversation as resolved.
if not notification.user.is_active:
return False
if (
acting_user := notification.data.get("acting_user", None)
Expand Down
8 changes: 8 additions & 0 deletions src/ephios/core/templates/core/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<script type="text/javascript" src="{% static "ephios/js/consequences.js" %}"></script>
{% endblock %}

{% block messages %}
{% if request.user.email_invalid %}
<div class="alert alert-warning" role="alert">
{% translate "We failed to send notifications to your email address. Please check your email address and contact an administrator." %}
</div>
{% endif %}
{% endblock %}

{% block content %}
<h1 class="page-header">
{% blocktranslate trimmed with organization_name=global_preferences.general__organization_name %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
{% load crispy_forms_filters %}
{% load i18n %}

{% block messages %}
{% if request.user.email_invalid %}
<div class="alert alert-warning" role="alert">
{% translate "We failed to send notifications to your email address. Please check your email address and contact an administrator." %}
</div>
{% endif %}
{% endblock %}

{% block settings_content %}
<div class="row">
<div class="col-12">
Expand Down
6 changes: 3 additions & 3 deletions src/ephios/core/templates/core/userprofile_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ <h1>{% translate "Add new user" %}</h1>
{% if userprofile.email_invalid %}
<div class="alert alert-warning" role="alert">
{% blocktranslate trimmed %}
The user is inactive because their email address is invalid. This can be caused by a typo or a problem
with the user's mail server. Please check the email address and correct it before activating the user
again.
The email address of the user is invalid. This can be caused by a typo or a problem
with the user's mail server. Please check the email address and correct it or ask the user to
solve the problem with their provider.
{% endblocktranslate %}
</div>
{% endif %}
Expand Down
Loading