From aa2daba2d901b89a0595c1e7a0f21badcb96ceae Mon Sep 17 00:00:00 2001 From: Thomas Fortier Date: Sun, 15 Oct 2017 14:33:53 -0400 Subject: [PATCH 1/2] Add basicAuth for main route --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index fef7650..e6ed35d 100644 --- a/main.py +++ b/main.py @@ -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 @@ -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(): @@ -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') From 65660323878951552762278563f6e88f96a4be36 Mon Sep 17 00:00:00 2001 From: Thomas Fortier Date: Sun, 15 Oct 2017 14:35:58 -0400 Subject: [PATCH 2/2] Add basicAuth in requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index a2ba31f..e217f6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ imutils flask picamera[array] +Flask-BasicAuth==0.2.0 \ No newline at end of file