From 8bd6e7f7f5466e2d76d833ae180f0f8989688cde Mon Sep 17 00:00:00 2001 From: BenediktMKuehne Date: Wed, 13 Nov 2024 11:22:50 +0000 Subject: [PATCH] ch activation url --- embark/users/urls.py | 2 +- embark/users/views.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/embark/users/urls.py b/embark/users/urls.py index 49781486..42b50676 100644 --- a/embark/users/urls.py +++ b/embark/users/urls.py @@ -12,7 +12,7 @@ path(settings.LOGIN_URL, views.embark_login, name='embark-login'), path('user/', views.user_main, name='embark-user-main'), path('user/register/', views.register, name='embark-register'), - path('user//activate/', views.activate, name='embark-activate-user'), + path('user/activate///', views.activate, name='embark-activate-user'), path('user/reset_password/', views.reset_password, name='embark-password-reset'), path(settings.LOGOUT_REDIRECT_URL, views.embark_logout, name='embark-logout'), path('user/password_change/', views.password_change, name='embark-password-change'), diff --git a/embark/users/views.py b/embark/users/views.py index a49f8e0d..5c56c118 100644 --- a/embark/users/views.py +++ b/embark/users/views.py @@ -67,7 +67,7 @@ def register(request): if settings.EMAIL_ACTIVE is True: send_mail(mail_subject, message, 'system@' + settings.DOMAIN, [email]) messages.success(request, 'Registration successful. Please check your email to activate') - return redirect(reverse('embark-activate-user', kwargs={'uuid': user.id})) + return redirect(reverse('embark-login')) else: logger.debug("Registered, redirecting to login") if activate_user(user, token): @@ -119,7 +119,6 @@ def embark_logout(request): return redirect('embark-login') -@permission_required("users.user_permission", login_url='/') @login_required(login_url='/' + settings.LOGIN_URL) @require_http_methods(["GET", "POST"]) def password_change(request): # TODO adapt t @@ -294,7 +293,7 @@ def activate_user(user, token) -> bool: @require_http_methods(["GET"]) @login_required(login_url='/' + settings.LOGIN_URL) -def activate(request, user_id, token): +def activate(request, token, user_id): """ activation page + form request activates user through the usage of token @@ -308,6 +307,8 @@ def activate(request, user_id, token): messages.error(request, "Token invalid - maybe it expired?") except ValueError as val_error: logger.error("%s in token %s", val_error, token) + except User.DoesNotExist as no_user_error: + logger.error("%s in request %s", no_user_error, request) return redirect(reverse('embark-MainDashboard'))