diff --git a/Client/cleanup.sh b/Client/cleanup.sh index 741ea66..ef9dedd 100755 --- a/Client/cleanup.sh +++ b/Client/cleanup.sh @@ -7,4 +7,5 @@ rm -rf Books/ rm -rf PGNs/ rm -rf tmp/ rm -rf *.dll -rm -rf cutechess* \ No newline at end of file +rm -rf cutechess* +rm -rf machine.txt \ No newline at end of file diff --git a/OpenBench/config.py b/OpenBench/config.py index 6c2af11..5c5da6b 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -20,7 +20,9 @@ USE_CROSS_APPROVAL = False -REQUIRE_LOGIN_TO_VIEW = False +REQUIRE_LOGIN_TO_VIEW = True + +REQUIRE_MANUAL_REGISTRATION = True OPENBENCH_CONFIG = { @@ -29,8 +31,10 @@ OPENBENCH_CONFIG = { # Generic Error Messages useful to those setting up their own instance 'error' : { - 'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us', - 'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account', + 'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us', + '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 diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index ff3a21e..610b195 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -271,10 +271,13 @@ a:link, a:visited, a:hover, a:active { background-color: #00AF00; } -#error { +#error pre { background-color: #EE7676; - padding: 8px; + padding: 6px; + margin: 0px; text-align: center; + font-family: "Courier Prime"; + font-size: 18px; } #content form h3 { diff --git a/OpenBench/views.py b/OpenBench/views.py index a893532..3e0446f 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -53,11 +53,8 @@ def render(request, template, content={}, always_allow=False): data.update({'config' : OpenBench.config.OPENBENCH_CONFIG}) if OpenBench.config.REQUIRE_LOGIN_TO_VIEW: - if not request.user.is_authenticated and not always_allow: - return django.http.HttpResponseRedirect('/login/') - - return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data) + return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['requires_login']) if request.user.is_authenticated: @@ -130,7 +127,9 @@ def register(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if request.method == 'GET': - return render(request, 'register.html', always_allow=True) + if not OpenBench.config.REQUIRE_MANUAL_REGISTRATION: + 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']: return index(request, error='Passwords Do Not Match') @@ -151,7 +150,7 @@ def register(request): return django.http.HttpResponseRedirect('/index/') -def login(request): +def login(request, error=''): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -163,7 +162,8 @@ def login(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 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: user = authenticate(request)