forked from SilvisPilvis/instaclone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.py
More file actions
45 lines (25 loc) · 849 Bytes
/
Copy pathapplication.py
File metadata and controls
45 lines (25 loc) · 849 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
35
36
37
38
39
40
41
42
43
44
45
import hashlib
import flask
secret_key = '01'
def create_application():
application = flask.Flask(__name__)
application.config.from_pyfile('configuration.py')
from database import db
db.init_app(app=application)
return application
application = create_application()
@application.cli.command()
def create_database():
from database import db
db.create_all()
@application.route('/registration/', methods=['GET', 'POST'])
def registration():
if flask.request.method == 'GET':
return flask.render_template('registration.html')
email = flask.request.form.get('email')
password = flask.request.form.get('password') + secret_key
hasher = hashlib.sha256()
hasher.update(password.encode('utf-8'))
hashed_password = hasher.hexdigest()
return hashed_password
application.run()