first commit

This commit is contained in:
Benjamin Sigonneau
2022-05-10 20:45:46 +02:00
commit 7423a26069
5 changed files with 4492 additions and 0 deletions

Binary file not shown.

33
app.py Executable file
View File

@@ -0,0 +1,33 @@
#! /usr/bin/env python3
from bottle import get, post, run, template
import smtplib
def send_confirm_email():
print('Sending confirmation email')
host = 'localhost'
port = 1025
server = smtplib.SMTP(host, port)
FROM = "welcome@superbuzz.com"
TO = "you@example.com"
MSG = """Subject: Welcome to SuperBuzz!
You're just one click away from SuperBuzz bliss! Click this confirmation link:
[confirmation link].
"""
server.sendmail(FROM, TO, MSG)
server.quit()
print('Confimration email sent.')
@get('/')
def home():
return template('home')
@post('/go')
def go():
send_confirm_email()
return template('go')
run(host='localhost', port=8080, debug=True)

4429
bottle.py Normal file

File diff suppressed because it is too large Load Diff

11
views/go.tpl Normal file
View File

@@ -0,0 +1,11 @@
<html>
<body>
<h1>Well done!</h1>
<p>We've sent you a confirmation email.</p>
<p>Check you inbox and confirm your subscription!</p>
<div><a href="/">[Back to home page]</a></div>
</body>
</html>

19
views/home.tpl Normal file
View File

@@ -0,0 +1,19 @@
<html>
<body>
<h1>Welcome to SuperBuzz!</h1>
<p>Use this form to sign-up and know all about the latest buzz!</p>
<form action="go" method="POST">
<label for="email_address">Email address:</label><br>
<input type="email" id="email_address" name="email_address"><br>
<label for="fullname">Full name:</label><br>
<input type="text" id="fullname" name="fullname">
<br /><br />
<input type="submit" value="Submit">
</form>
</body>
</html>