Commit 2e94ba76 authored by David Haynes's avatar David Haynes 🙆

Merge branch 'issue85' into '2.2-dev'

Issue85

See merge request !61
parents a1dcfecf 569f722c
Pipeline #681 passed with stage
in 1 minute and 25 seconds
# Go (URL Shortener) [![build status](https://git.gmu.edu/srct/go/badges/master/build.svg)](https://git.gmu.edu/srct/go/commits/master) [![coverage report](https://git.gmu.edu/srct/go/badges/master/coverage.svg)](https://git.gmu.edu/srct/go/commits/master)
# Go (URL Shortener) [![build status](https://git.gmu.edu/srct/go/badges/master/build.svg)](https://git.gmu.edu/srct/go/commits/master) [![coverage report](https://git.gmu.edu/srct/go/badges/2.2-dev/coverage.svg)](https://git.gmu.edu/srct/go/commits/2.2-dev)
A project of [GMU SRCT](http://srct.gmu.edu).
......
......@@ -337,13 +337,13 @@ def useradmin(request):
settings.EMAIL_FROM,
[user_mail]
)
# If we're denying users
elif '_deny' in request.POST:
for name in userlist:
toDeny = RegisteredUser.objects.get(user__username__exact=name)
if settings.EMAIL_HOST and settings.EMAIL_PORT:
user_mail = toDeny.user.username + settings.EMAIL_DOMAIN
# Send an email letting them know they are denied
send_mail(
'Your Account has been Denied!',
......@@ -362,6 +362,7 @@ def useradmin(request):
# Delete their associated RegisteredUsers
toDeny.user.delete()
return HttpResponseRedirect('useradmin')
# If we're blocking users
elif '_block' in request.POST:
for name in userlist:
......@@ -384,9 +385,8 @@ def useradmin(request):
)
# toBlock.user.delete()
toBlock.blocked = True
toBlock.approved = False
toBlock.registered = False
toBlock.save()
# If we're un-blocking users
elif '_unblock' in request.POST:
for name in userlist:
......@@ -433,10 +433,12 @@ def useradmin(request):
)
toRemove.user.delete()
return HttpResponseRedirect('useradmin')
# Get a list of all RegisteredUsers that need to be approved
need_approval = RegisteredUser.objects.filter(registered=True).filter(approved=False)
# Get a list of all RegisteredUsers that need to be approved
need_approval = RegisteredUser.objects.filter(registered=True).filter(approved=False).filter(blocked=False)
# Get a list of all RegisteredUsers that are currently users
current_users = RegisteredUser.objects.filter(approved=True).filter(registered=True).filter(blocked=False)
# Get a list of all RegisteredUsers that are blocked
blocked_users = RegisteredUser.objects.filter(blocked=True)
# Pass that list to the template
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment