-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
34 lines (26 loc) · 797 Bytes
/
app.py
File metadata and controls
34 lines (26 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask, render_template, request
app = Flask(__name__)
users = {}
@app.route('/')
def homeHandler():
return render_template('home.html')
@app.route('/sign-up', methods=[ 'GET', 'POST' ])
def signUpHandler():
if request.method == 'GET':
return render_template("sign-up.html")
else:
u_name = request.form['user_name']
password = request.form['password']
if users.get( u_name ):
return 'User already exists. Please <a href="/sign-in">sign in</a> to continue.'
else:
users[ u_name ] = password
return 'I am signing up %s' %u_name
@app.route('/sign-in', methods=[ 'GET', 'POST' ])
def signInHandler():
if request.method == 'GET':
return 'Sign in handler not configured.'
else:
return 'I am signing in'
if __name__ == '__main__':
app.run(debug=True)