fixed some things

This commit is contained in:
downhill 2018-11-07 12:08:46 +00:00
commit b512ee2f61
3 changed files with 11 additions and 4 deletions

View file

@ -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()

View file

@ -4,6 +4,10 @@
RABBITMQ = guest:guest@127.0.0.1
[EMAIL]
EMAILFROM = info@ungleich.ch
[LDAP]
# Set up the user who can search