Skip to content

Commit

Permalink
Merge pull request #2624 from ARUP-CAS/test
Browse files Browse the repository at this point in the history
v1.0.16-rc2
  • Loading branch information
motyc authored Nov 24, 2024
2 parents 41694bc + dc8ca5d commit 0774cd9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Dobrý den,
tato zpráva slouží k ověření vaší emailové adresy, což je nezbytný krok pro získání přístupu do AMČR.

Svoji emailovou adresu ověříte kliknutím na níže uvedený odkaz:
{% get_site_url %}{% url 'django_registration_activate' activation_key %}
{% get_site_url %}{% url 'django_registration_activate' %}

Do aktivačního formuláře zadejte následující aktivační klíč: {{ activation_key }}

Tento odkaz expiruje za {{ expiration_days }} dní.

Expand All @@ -20,7 +22,9 @@ Hello,
This message is to verify your email address, which is a necessary step to gain access to the AMCR.

You can verify your email address by clicking on the link below:
{% get_site_url %}{% url 'django_registration_activate' activation_key %}
{% get_site_url %}{% url 'django_registration_activate' %}

Insert the following activation key to the activation form: {{ activation_key }}

This link expires in {{ expiration_days }} days.

Expand Down
28 changes: 28 additions & 0 deletions webclient/templates/django_registration/activation_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load crispy_forms_tags %}

{% block title %}{% trans "templates.djangoRegistration.activationForm.title" %}{% endblock %}
{% block head %}
{% endblock %}

{% block content %}
<div class="app-login-wrapper">
<div class="row">
<div class="col-lg-4">
<img class="mb-4 app-logo" src="{% static 'logo-amcr-cs.svg' %}" alt="{% trans 'templates.djangoRegistration.registrationForm.logo.alt' %}">
<div class="card">
<div class="card-body">
<form method="post" class="form-group submit-spinner mb-0">
{{ errors }}
{{ form.activation_key|as_crispy_field }}
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans 'templates.djangoRegistration.activationForm.submit' %}">
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
5 changes: 1 addition & 4 deletions webclient/uzivatel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,7 @@ def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
return super().dispatch(request, *args, **kwargs)

def activate(self, *args, **kwargs):
username = self.validate_key(kwargs.get("activation_key"))
user = self.get_user(username)
logger.debug("uzivatel.views.activate.success", extra={"user": user.ident_cely})
user.save()
user = super().activate(*args, **kwargs)
for notification in UserNotificationType.objects.filter(ident_cely__icontains="S-E-"):
user.notification_types.add(notification)
cutoff_time = timezone.now() - datetime.timedelta(minutes=10)
Expand Down
2 changes: 1 addition & 1 deletion webclient/webclient/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
odstavka_in_progress(TemplateView.as_view(template_name="django_registration/registration_closed.html")),
name="django_registration_disallowed",
),
path("accounts/activate/<str:activation_key>/", UserActivationView.as_view(), name="django_registration_activate"),
path("accounts/activate/", UserActivationView.as_view(), name="django_registration_activate"),
path(
"accounts/login/",
UserLoginView.as_view(),
Expand Down

0 comments on commit 0774cd9

Please sign in to comment.