diff --git a/web/templates/base.html b/web/templates/base.html index 76a0785fbe105d9fbb37f4021e73af7f43c96a8b..373596165d31ccc3ac0405bfb83f83d1d0a490f2 100644 --- a/web/templates/base.html +++ b/web/templates/base.html @@ -77,7 +77,7 @@ <div class="container"> <div class="container"> <div class="navbar-header"> - <p class="text-muted"><small>Warpzone</small></p> + <p class="text-muted"><small>Warpzone</small></p>{% get_current_language as LANGUAGE_CODE %} {{ LANGUAGE_CODE}} </div> </div> </div> diff --git a/web/warpauth/views/login.py b/web/warpauth/views/login.py index cffb99b3c9c169f3189ea40c5c2296b98fb6d7b6..7bc07bcaa6f2b63501d6a1245f06ca9674c80fad 100644 --- a/web/warpauth/views/login.py +++ b/web/warpauth/views/login.py @@ -3,7 +3,7 @@ from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAll from django.contrib.auth import authenticate, login, logout from django.shortcuts import redirect from django.contrib.auth.decorators import login_required - +from django.utils import translation from warpauth.util import * def login_view(request): @@ -18,6 +18,10 @@ def login_view(request): if user is not None: if user.is_active: login(request, user) + + user_language = 'de_DE' + translation.activate(user_language) + request.session[translation.LANGUAGE_SESSION_KEY] = user_language return redirect('/') else: if username != "" and password != "": diff --git a/web/warpzone/settings.py b/web/warpzone/settings.py index 6ceebef7e727572986df19e6945a6238eecd77d3..562aabb2bd6363f6d13a294d6085f36470faba56 100644 --- a/web/warpzone/settings.py +++ b/web/warpzone/settings.py @@ -155,7 +155,7 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch(AUTH_LDAP_USER_SEARCH_PATH, AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn", "email": "description"} AUTH_LDAP_PROFILE_ATTR_MAP = {"home_directory": "homeDirectory"} -AUTH_LDAP_GROUP_SEARCH_PATH = "ou=Groups,dc=warpzone,dc=ms" +AUTH_LDAP_GROUP_SEARCH_PATH = "dc=warpzone,dc=ms" AUTH_LDAP_GROUP_SEARCH = LDAPSearch(AUTH_LDAP_GROUP_SEARCH_PATH, ldap.SCOPE_SUBTREE, "(objectClass=posixGroup)" ) @@ -163,16 +163,16 @@ AUTH_LDAP_GROUP_SEARCH = LDAPSearch(AUTH_LDAP_GROUP_SEARCH_PATH, AUTH_LDAP_GROUP_TYPE = PosixGroupType() AUTH_LDAP_USER_FLAGS_BY_GROUP = { - "is_active": "cn=active,ou=Groups,dc=warpzone,dc=ms", - "is_staff": ["cn=superuser,ou=Groups,dc=warpzone,dc=ms", - "cn=superuser,ou=Groups,dc=warpzone,dc=ms"], - "is_superuser": "cn=superuser,ou=Groups,dc=warpzone,dc=ms" + "is_active": "cn=active,ou=groups,ou=WarpAuth,ou=Warpzone,dc=warpzone,dc=ms", + "is_staff": ["cn=superuser,ou=groups,ou=WarpAuth,ou=Warpzone,dc=warpzone,dc=ms", + "cn=superuser,ou=groups,ou=WarpAuth,ou=Warpzone,dc=warpzone,dc=ms"], + "is_superuser": "cn=superuser,ou=groups,ou=WarpAuth,ou=Warpzone,dc=warpzone,dc=ms" } AUTH_LDAP_FIND_GROUP_PERMS = True AUTH_LDAP_CACHE_GROUPS = True -AUTH_LDAP_GROUP_CACHE_TIMEOUT = 300 +AUTH_LDAP_GROUP_CACHE_TIMEOUT = 10 logger = logging.getLogger('django_auth_ldap') logger.addHandler(logging.StreamHandler()) diff --git a/web_docker/Dockerfile b/web_docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d7a616ffabe8ace78af225104d1c530057cda3b0 --- /dev/null +++ b/web_docker/Dockerfile @@ -0,0 +1,34 @@ +From debian:jessie + +RUN apt-get update && apt-get install -y \ + debconf-utils \ + apt-utils \ + ssh \ + less \ + ldap-utils \ + rsyslog \ + nano \ + python \ + python-pip \ + python-django-auth-ldap \ + python-bootstrapform \ + python-ldap \ + python-dev + build-essential \ + libfreetype6-dev \ + python-imaging \ + libjpeg-dev + +RUN pip install django \ + django-ldapdb \ + reportlab + +RUN cd /opt/warpauth/;python manage.py migrate + +COPY entrypoint.sh /opt/entrypoint.sh +EXPOSE 22 8000 + +VOLUME ["/opt/warpauth"] + +ENTRYPOINT sh /opt/entrypoint.sh + diff --git a/web_docker/build.sh b/web_docker/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..e833f908456e6ca425b9f345c2fe4a76c8e478d9 --- /dev/null +++ b/web_docker/build.sh @@ -0,0 +1 @@ +docker build -t warpauth_web . diff --git a/web_docker/entrypoint.sh b/web_docker/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..bb41662d21311acc10f88f908b4d04574c210c02 --- /dev/null +++ b/web_docker/entrypoint.sh @@ -0,0 +1,3 @@ +service rsyslog restart +bash + diff --git a/web_docker/run.sh b/web_docker/run.sh new file mode 100644 index 0000000000000000000000000000000000000000..d043c24f2146068a6fe43995d662cd769852ccec --- /dev/null +++ b/web_docker/run.sh @@ -0,0 +1,5 @@ +docker run \ + -v /home/chris/Documents/warpzone/web:/opt/warpauth \ + -p 8124:80 \ + -it \ + warpauth_web