Skip to content

Commit

Permalink
ch activation url
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMKuehne committed Nov 13, 2024
1 parent ef9b501 commit 8bd6e7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion embark/users/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<int:user_id>/activate/<str:token>', views.activate, name='embark-activate-user'),
path('user/activate/<int:user_id>/<str:token>/', 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'),
Expand Down
7 changes: 4 additions & 3 deletions embark/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'))


Expand Down

0 comments on commit 8bd6e7f

Please sign in to comment.