Skip to content

Commit fb50b6f

Browse files
authored
Merge pull request #5 from thomfort/master
Add BasicAuth for main route
2 parents 625064d + 6566032 commit fb50b6f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from mail import sendEmail
44
from flask import Flask, render_template, Response
55
from camera import VideoCamera
6+
from flask_basicauth import BasicAuth
67
import time
78
import threading
89

@@ -12,6 +13,11 @@
1213

1314
# App Globals (do not edit)
1415
app = Flask(__name__)
16+
app.config['BASIC_AUTH_USERNAME'] = 'CHANGE_ME_USERNAME'
17+
app.config['BASIC_AUTH_PASSWORD'] = 'CHANGE_ME_PLEASE'
18+
app.config['BASIC_AUTH_FORCE'] = True
19+
20+
basic_auth = BasicAuth(app)
1521
last_epoch = 0
1622

1723
def check_for_objects():
@@ -28,6 +34,7 @@ def check_for_objects():
2834
print "Error sending email: ", sys.exc_info()[0]
2935

3036
@app.route('/')
37+
@basic_auth.required
3138
def index():
3239
return render_template('index.html')
3340

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
imutils
22
flask
33
picamera[array]
4+
Flask-BasicAuth==0.2.0

0 commit comments

Comments
 (0)