fixed some things
This commit is contained in:
parent
39f08c7939
commit
b512ee2f61
3 changed files with 11 additions and 4 deletions
|
@ -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 <root@localhost>'
|
||||
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()
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
RABBITMQ = guest:guest@127.0.0.1
|
||||
|
||||
[EMAIL]
|
||||
|
||||
EMAILFROM = info@ungleich.ch
|
||||
|
||||
[LDAP]
|
||||
|
||||
# Set up the user who can search
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue