diff --git a/dal/dal/views.py b/dal/dal/views.py index e3ee6d1..e974cf9 100644 --- a/dal/dal/views.py +++ b/dal/dal/views.py @@ -17,6 +17,10 @@ from datetime import datetime from django_nameko import get_pool from random import choice, randint import string +from configparser import ConfigParser + +config = ConfigParser() +config.read('userservice.conf') # Check to see if the username is already taken # Helper function, not to be set up as a view @@ -226,7 +230,7 @@ class ResetPassword(View): # getting epoch for the time now in UTC to spare us headache with timezones creationtime = int(datetime.utcnow().timestamp()) # Construct the data for the email - email_from = 'Userservice at ungleich ' + email_from = 'Userservice at ungleich <%s>' % config['EMAIL']['EMAILFROM'] to = ['%s <%s>' % (user, email)] subject = 'Password reset request for %s' % user link = self.build_reset_link(user, creationtime) @@ -252,7 +256,7 @@ class ResetPassword(View): # Builds the reset link for the email and puts the token into the database def build_reset_link(self, user, epochutc): # set up the data - host = 'localhost:8000' + host = 'account-staging.ungleich.ch' tokengen = PasswordResetTokenGenerator() # create some noise for use in the tokengenerator pseudouser = PseudoUser() diff --git a/dal/userservice.conf.example b/dal/userservice.conf.example index a34bfbd..17074da 100644 --- a/dal/userservice.conf.example +++ b/dal/userservice.conf.example @@ -4,6 +4,10 @@ RABBITMQ = guest:guest@127.0.0.1 +[EMAIL] + +EMAILFROM = info@ungleich.ch + [LDAP] # Set up the user who can search diff --git a/nameko-func.py b/nameko-func.py index ae216b2..d43a4bc 100644 --- a/nameko-func.py +++ b/nameko-func.py @@ -62,7 +62,7 @@ def objclasses(rdn, uid, connection): connection.search(rdn, '(%s)' % uid, attributes=['objectClass']) objclass = [] # get the relevant data - tmp = conn.entries[0]['objectClass'] + tmp = connection.entries[0]['objectClass'] # This one sets up the array for y in tmp: objclass.append(y) @@ -116,7 +116,6 @@ class CreateUser(object): # set objectClasses for the new user obj_new_user = ObjectDef(['inetOrgPerson', 'posixAccount', 'ldapPublicKey'], conn) w = Writer(conn, obj_new_user) - # newly created users get put into ou=customers dn = 'uid=%s,ou=users,dc=ungleich,dc=ch' % user w.new(dn) # Filling in some of the data