-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
39 lines (33 loc) · 1.06 KB
/
run.py
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
from flask import Flask, render_template,request
from flask_socketio import SocketIO, join_room, emit
import random
import json
from flask_cors import CORS
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
CORS(app)
connectedClients = []
secure_random = random.SystemRandom()
roomList = ['general','tech']
@app.route("/")
def index():
if request.remote_addr in connectedClients:
return render_template('index.html')
else:
return render_template('login.html')
@app.route('/createAccount', methods=['GET', 'POST'])
def createAccount():
if request.method == 'POST':
pass
return redirect("http://localhost:5000/login", code=302)
return render_template('create_account.html')
@app.route('/login', methods=['GET', 'POST'])
def login():
error = None
if request.method == 'POST':
pass
else:
error = 'Invalid Credentials. Please try again.'
return redirect("http://localhost:5000/", code=302)
return render_template('login.html', error=error)