Compare commits
2 Commits
77d728a153
...
90dca0274a
Author | SHA1 | Date |
---|---|---|
vilmibm | 90dca0274a | |
vilmibm | 158bdcff5f |
|
@ -20,15 +20,15 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>tilde.town guestbook</h1>
|
<h1>tilde.town guestbook</h1>
|
||||||
|
<p><em>don't try to post urls. it won't work.</em></p>
|
||||||
<marquee>~*~*~*~*say hello*~*~*~*~</marquee>
|
<marquee>~*~*~*~*say hello*~*~*~*~</marquee>
|
||||||
<!-- <form class="tilde" action="{% url 'guestbook:guestbook' %}" method="post">
|
<form class="tilde" action="{% url 'guestbook:guestbook' %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
{{form.as_table}}
|
{{form.as_table}}
|
||||||
</table>
|
</table>
|
||||||
<input type="submit" value="sign" >
|
<input type="submit" value="sign" >
|
||||||
</form>
|
</form>
|
||||||
-->
|
|
||||||
|
|
||||||
{% for m in messages %}
|
{% for m in messages %}
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -78,6 +78,13 @@ class Townie(User):
|
||||||
def home(self):
|
def home(self):
|
||||||
return os.path.join('/home', self.username)
|
return os.path.join('/home', self.username)
|
||||||
|
|
||||||
|
def generate_gift(self):
|
||||||
|
command = '/town/bin/generate_welcome_present.sh'
|
||||||
|
error = _guarded_run(['sudo', command, self.username])
|
||||||
|
if error:
|
||||||
|
logger.error(error)
|
||||||
|
return
|
||||||
|
|
||||||
def send_welcome_email(self):
|
def send_welcome_email(self):
|
||||||
welcome_tmpl = get_template('users/welcome_email.txt')
|
welcome_tmpl = get_template('users/welcome_email.txt')
|
||||||
context = {
|
context = {
|
||||||
|
@ -250,9 +257,11 @@ def on_townie_pre_save(sender, instance, **kwargs):
|
||||||
instance.create_on_disk()
|
instance.create_on_disk()
|
||||||
instance.write_authorized_keys()
|
instance.write_authorized_keys()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Failed syncing user {} to disk: {}'.format(instance.username, e)
|
logger.error('Failed syncing user {} to disk: {}'.format(instance.username, e))
|
||||||
else:
|
else:
|
||||||
instance.send_welcome_email()
|
instance.send_welcome_email()
|
||||||
|
instance.generate_gift()
|
||||||
|
|
||||||
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