Commit f82e3667 authored by Zosman's avatar Zosman
Browse files

draft 1

parent 34c1a2d9
Pipeline #433 failed with stage
in 6 minutes and 36 seconds
......@@ -19,6 +19,9 @@ class RegisteredUser(models.Model):
that that user is registered.
"""
# Is this User Bloacked?
blocked = models.BooleanField(default=False)
# Let's associate a User to this RegisteredUser
user = models.OneToOneField(User)
......
......@@ -65,6 +65,7 @@ SRCT Go • Administration Panel
<input type="submit" name="_approve" value="Approve" class="btn btn-primary btn-sm">
<input type="submit" name="_deny" value="Deny" class="btn btn-danger btn-sm">
<input type="submit" name="_block" value="Block" class="btn btn-default btn-sm" style="background-color: black; color: white;">
</div>
......
......@@ -16,6 +16,11 @@ from go.forms import URLForm, SignupForm
# Other Imports
from datetime import timedelta
requestObject = request.RegisteredUser.objects.get(user__username__exact=user)
if requestObject.user.registereduser.blocked != False
raise PermissionDenied()
def index(request):
"""
This view handles the homepage that the user is presented with when
......@@ -319,6 +324,27 @@ def useradmin(request):
[user_mail]
)
todeny.user.delete()
elif '_block' in request.POST:
for name in userlist:
toblock = RegisteredUser.objects.get(user__username__exact=name)
if settings.EMAIL_HOST and settings.EMAIL_PORT:
user_mail = toblock.user.username + settings.EMAIL_DOMAIN
send_mail(
'Your Account has been Blocked!',
######################
'Hey there %s,\n\n'
'The Go admins have reviewed your application and have '
'blocked you from using Go.\n\n'
'Please reach out to srct@gmu.edu to appeal '
'this decision.\n\n'
'- Go Admins'
% (str(toblock.full_name)),
######################
settings.EMAIL_FROM,
[user_mail]
)
# toblock.user.delete()
toblock.user.registereduser.blocked = True
need_approval = RegisteredUser.objects.filter(registered=True).filter(approved=False)
return render(request, 'admin/useradmin.html', {
'need_approval': need_approval
......
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