Skip to content

Commit

Permalink
Merge pull request #519 from iMMAP/fix/do_not_activate_non_email_veri…
Browse files Browse the repository at this point in the history
…fied_users

user should have verified email to be activated
  • Loading branch information
shtayeb authored Dec 24, 2024
2 parents 52e3485 + 1ac3f50 commit 505f587
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/users/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def toggle_status(request, user_id):
if not has_permission(user=request.user, user_obj=user):
raise PermissionDenied

if user.profile.email_verified_at is None:
raise PermissionDenied(
f"{user} has not verified their email. Please ask the user to verifiy their email first."
)

if user.is_active:
user.is_active = False
user.save()
Expand Down

0 comments on commit 505f587

Please sign in to comment.