Notify Users that have been made via Django/CMD, but do not exist as OpenBench Profiles
This commit is contained in:
1 parent
610899a521
commit
e6348916e2
3 files changed
+21
-12
No files matched your search
+7
-2
@@ -20,10 +20,15 @@
|
||||
|
||||
OPENBENCH_CONFIG = {
|
||||
|
||||
# Sidebar link, location of resources, and contact information
|
||||
'error' : {
|
||||
'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us',
|
||||
'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account',
|
||||
},
|
||||
|
||||
|
||||
# Link to the repo on the sidebar, as well as the core files
|
||||
'framework' : 'http://github.com/AndyGrant/OpenBench/',
|
||||
'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/master/CoreFiles/',
|
||||
'serveradmin' : 'andrew@grantnet.us',
|
||||
|
||||
# SPRT Elo bounds and type I/II errors
|
||||
'sprt' : { 'elolower' : 0.00, 'eloupper' : 5.00, 'alpha' : 0.05, 'beta' : 0.05 },
|
||||
|
||||
+14
-2
@@ -41,10 +41,22 @@ import OpenBench.utils, datetime
|
||||
|
||||
def render(request, template, data={}):
|
||||
|
||||
# Provide Configuration & User information
|
||||
# Always provide the basic configuration
|
||||
data.update({'config' : OPENBENCH_CONFIG})
|
||||
|
||||
if request.user.is_authenticated:
|
||||
data.update({'profile' : Profile.objects.get(user=request.user)})
|
||||
|
||||
# Provide user information when possible
|
||||
profile = Profile.objects.filter(user=request.user).first()
|
||||
data.update({'config' : OPENBENCH_CONFIG, 'profile' : profile})
|
||||
|
||||
# Warn Users that they need to be enabled
|
||||
if profile and not profile.enabled:
|
||||
data.update({'error' : OPENBENCH_CONFIG['error']['disabled']})
|
||||
|
||||
# Warn any non-OpenBench users made by some means
|
||||
if request.user.is_authenticated and not profile:
|
||||
data.update({'error' : OPENBENCH_CONFIG['error']['fakeuser']})
|
||||
|
||||
# Wrapper to simplify django's rendering function
|
||||
return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data)
|
||||
|
||||
@@ -22,14 +22,6 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Tell unauthenticated users to contact the Admin -->
|
||||
{% if request.user.is_authenticated and not profile.enabled %}
|
||||
<div id="error">
|
||||
<strong>{{profile.user.username}}! Your account is not enabled.</strong>
|
||||
<strong>Contact the Admin ( {{config.serveradmin}} )</strong>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="sidebar">
|
||||
|
||||
<ul>
|
||||
|
||||
Reference in new issue
Block a user