Skip to content

Commit

Permalink
Merge pull request #5 from thomfort/master
Browse files Browse the repository at this point in the history
Add BasicAuth for main route
  • Loading branch information
atainter authored May 23, 2018
2 parents 625064d + 6566032 commit fb50b6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from mail import sendEmail
from flask import Flask, render_template, Response
from camera import VideoCamera
from flask_basicauth import BasicAuth
import time
import threading

Expand All @@ -12,6 +13,11 @@

# App Globals (do not edit)
app = Flask(__name__)
app.config['BASIC_AUTH_USERNAME'] = 'CHANGE_ME_USERNAME'
app.config['BASIC_AUTH_PASSWORD'] = 'CHANGE_ME_PLEASE'
app.config['BASIC_AUTH_FORCE'] = True

basic_auth = BasicAuth(app)
last_epoch = 0

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

@app.route('/')
@basic_auth.required
def index():
return render_template('index.html')

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
imutils
flask
picamera[array]
Flask-BasicAuth==0.2.0

0 comments on commit fb50b6f

Please sign in to comment.