parent
							
								
									2b2db9109a
								
							
						
					
					
						commit
						519169e49e
					
				| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
from django.db import models
 | 
					from django.db import models
 | 
				
			||||||
 | 
					from django.db.models.signals import post_save
 | 
				
			||||||
from django.contrib.auth.models import User
 | 
					from django.contrib.auth.models import User
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class UserProfile(models.Model):
 | 
					class UserProfile(models.Model):
 | 
				
			||||||
| 
						 | 
					@ -7,3 +8,12 @@ class UserProfile(models.Model):
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def __unicode__(self):
 | 
						def __unicode__(self):
 | 
				
			||||||
		return "%s (Kontostand: %s)" % (self.user ,self.balance)
 | 
							return "%s (Kontostand: %s)" % (self.user ,self.balance)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def createUserProfile(sender, instance, created, **kwargs):
 | 
				
			||||||
 | 
						if created:
 | 
				
			||||||
 | 
							profile = UserProfile()
 | 
				
			||||||
 | 
							profile.user = instance
 | 
				
			||||||
 | 
							profile.save()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					post_save.connect(createUserProfile, sender=User)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,8 +71,8 @@ LOGIN_URL = '/user/login/'
 | 
				
			||||||
LOGIN_REDIRECT_URL = '/'
 | 
					LOGIN_REDIRECT_URL = '/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUTHENTICATION_BACKENDS = (
 | 
					AUTHENTICATION_BACKENDS = (
 | 
				
			||||||
	'main.backend.CustomLDAPBackend',
 | 
					#	'main.backend.CustomLDAPBackend',
 | 
				
			||||||
#	'django_auth_ldap.backend.LDAPBackend',
 | 
						'django_auth_ldap.backend.LDAPBackend',
 | 
				
			||||||
	'django.contrib.auth.backends.ModelBackend',
 | 
						'django.contrib.auth.backends.ModelBackend',
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ AUTHENTICATION_BACKENDS = (
 | 
				
			||||||
AUTH_LDAP_SERVER_URI = 'ldaps://chef.freitagsrunde.org'
 | 
					AUTH_LDAP_SERVER_URI = 'ldaps://chef.freitagsrunde.org'
 | 
				
			||||||
AUTH_LDAP_START_TLS = False # we already use LDAPS
 | 
					AUTH_LDAP_START_TLS = False # we already use LDAPS
 | 
				
			||||||
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=freitagsrunde,dc=org"
 | 
					AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=freitagsrunde,dc=org"
 | 
				
			||||||
AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn"}
 | 
					AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn", "email": "mail"}
 | 
				
			||||||
AUTH_LDAP_GLOBAL_OPTIONS = {ldap.OPT_X_TLS_CACERTFILE: "data/cacert.txt"}
 | 
					AUTH_LDAP_GLOBAL_OPTIONS = {ldap.OPT_X_TLS_CACERTFILE: "data/cacert.txt"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Nur ein Beispiel, falls technik@ automatisch admin der Kasse werden soll.
 | 
					## Nur ein Beispiel, falls technik@ automatisch admin der Kasse werden soll.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue