atomic user creation/notification
parent
4e3977edd2
commit
5220d9bfad
|
@ -246,9 +246,13 @@ def on_townie_pre_save(sender, instance, **kwargs):
|
||||||
# See if we need to create the user on disk.
|
# See if we need to create the user on disk.
|
||||||
if existing.unreviewed and instance.accepted:
|
if existing.unreviewed and instance.accepted:
|
||||||
logger.info('Creating user {} on disk.'.format(instance.username))
|
logger.info('Creating user {} on disk.'.format(instance.username))
|
||||||
instance.create_on_disk()
|
try:
|
||||||
instance.send_welcome_email()
|
instance.create_on_disk()
|
||||||
instance.write_authorized_keys()
|
instance.write_authorized_keys()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Failed syncing user {} to disk: {}'.format(instance.username, e)
|
||||||
|
else:
|
||||||
|
instance.send_welcome_email()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# This user state transition is currently undefined. In the future, we can check for things
|
# This user state transition is currently undefined. In the future, we can check for things
|
||||||
|
|
Loading…
Reference in New Issue