Finalize hiding public information in settings
This commit is contained in:
1 parent
c02e0782b6
commit
f22883647d
4 files changed
+17
-9
No files matched your search
@@ -8,3 +8,4 @@ rm -rf PGNs/
|
|||||||
rm -rf tmp/
|
rm -rf tmp/
|
||||||
rm -rf *.dll
|
rm -rf *.dll
|
||||||
rm -rf cutechess*
|
rm -rf cutechess*
|
||||||
|
rm -rf machine.txt
|
||||||
+5
-1
@@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
USE_CROSS_APPROVAL = False
|
USE_CROSS_APPROVAL = False
|
||||||
|
|
||||||
REQUIRE_LOGIN_TO_VIEW = False
|
REQUIRE_LOGIN_TO_VIEW = True
|
||||||
|
|
||||||
|
REQUIRE_MANUAL_REGISTRATION = True
|
||||||
|
|
||||||
OPENBENCH_CONFIG = {
|
OPENBENCH_CONFIG = {
|
||||||
|
|
||||||
@@ -31,6 +33,8 @@ OPENBENCH_CONFIG = {
|
|||||||
'error' : {
|
'error' : {
|
||||||
'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us',
|
'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us',
|
||||||
'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account',
|
'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account',
|
||||||
|
'requires_login' : 'All pages require a user login to access',
|
||||||
|
'manual_registration' : 'Registration can only be done via an Administrator',
|
||||||
},
|
},
|
||||||
|
|
||||||
# Link to the repo on the sidebar, as well as the core files
|
# Link to the repo on the sidebar, as well as the core files
|
||||||
|
|||||||
@@ -271,10 +271,13 @@ a:link, a:visited, a:hover, a:active {
|
|||||||
background-color: #00AF00;
|
background-color: #00AF00;
|
||||||
}
|
}
|
||||||
|
|
||||||
#error {
|
#error pre {
|
||||||
background-color: #EE7676;
|
background-color: #EE7676;
|
||||||
padding: 8px;
|
padding: 6px;
|
||||||
|
margin: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
font-family: "Courier Prime";
|
||||||
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content form h3 {
|
#content form h3 {
|
||||||
|
|||||||
+6
-6
@@ -53,11 +53,8 @@ def render(request, template, content={}, always_allow=False):
|
|||||||
data.update({'config' : OpenBench.config.OPENBENCH_CONFIG})
|
data.update({'config' : OpenBench.config.OPENBENCH_CONFIG})
|
||||||
|
|
||||||
if OpenBench.config.REQUIRE_LOGIN_TO_VIEW:
|
if OpenBench.config.REQUIRE_LOGIN_TO_VIEW:
|
||||||
|
|
||||||
if not request.user.is_authenticated and not always_allow:
|
if not request.user.is_authenticated and not always_allow:
|
||||||
return django.http.HttpResponseRedirect('/login/')
|
return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['requires_login'])
|
||||||
|
|
||||||
return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data)
|
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
|
||||||
@@ -130,7 +127,9 @@ def register(request):
|
|||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
|
if not OpenBench.config.REQUIRE_MANUAL_REGISTRATION:
|
||||||
return render(request, 'register.html', always_allow=True)
|
return render(request, 'register.html', always_allow=True)
|
||||||
|
return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['manual_registration'])
|
||||||
|
|
||||||
if request.POST['password1'] != request.POST['password2']:
|
if request.POST['password1'] != request.POST['password2']:
|
||||||
return index(request, error='Passwords Do Not Match')
|
return index(request, error='Passwords Do Not Match')
|
||||||
@@ -151,7 +150,7 @@ def register(request):
|
|||||||
|
|
||||||
return django.http.HttpResponseRedirect('/index/')
|
return django.http.HttpResponseRedirect('/index/')
|
||||||
|
|
||||||
def login(request):
|
def login(request, error=''):
|
||||||
|
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
# #
|
# #
|
||||||
@@ -163,7 +162,8 @@ def login(request):
|
|||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(request, 'login.html', always_allow=True)
|
data = { 'error' : error }
|
||||||
|
return render(request, 'login.html', data, always_allow=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = authenticate(request)
|
user = authenticate(request)
|
||||||
|
|||||||
Reference in new issue
Block a user