Fix user detail wrong first, last name order; Fix user invalid login page on valid login.

This commit is contained in:
Götz 2019-04-12 18:23:57 +02:00
parent e74878c0c4
commit 26cfc9e334
2 changed files with 3 additions and 2 deletions

View File

@ -41,9 +41,11 @@ def realm_list(request):
if len(realms) == 0 and not user.is_superuser:
try:
LdapUser.base_dn = LdapUser.ROOT_DN
user = LdapUser.objects.get(username=user.username)
realm_base_dn = re.compile('(uid=[a-zA-Z0-9_]*),(ou=[a-zA-Z_]*),(.*)').match(user.dn).group(3)
realm = Realm.objects.get(ldap_base_dn=realm_base_dn)
return redirect('realm-user-detail', realm.id, user.dn)
except ObjectDoesNotExist as err:
logger.info('Anmeldung fehlgeschlagen', err)
@ -103,7 +105,6 @@ def realm_detail(request, realm_id):
realm = Realm.objects.get(id=realm_id)
ldap_admin_group = None
ldap_default_group = None
print('ADMIN GROUP', realm.admin_group)
if realm.admin_group:
LdapGroup.base_dn = f'ou=groups,{realm.ldap_base_dn}'
ldap_admin_group = LdapGroup.objects.get(name=realm.admin_group.name)

View File

@ -9,7 +9,7 @@
<div class="card">
<div class="card-body">
<h5 class="card-title">{{ user.username }}</h5>
<h6 class="card-subtitle mb-2 text-muted">{{ user.first_name }}, {{ user.last_name }}</h6>
<h6 class="card-subtitle mb-2 text-muted">{{ user.last_name }}, {{ user.first_name }}</h6>
<ul class="list-group list-group-flush">
{% if groups %}
<li class="list-group-item">