Skip to content

Commit

Permalink
Python3 (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
ab77 committed May 19, 2019
1 parent 2da11b4 commit 84c2a47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def is_redirected():


def csrf_token():
if not session.has_key('csrf_token'):
if not 'csrf_token' in session:
from uuid import uuid4
session.csrf_token = uuid4().hex
return session.csrf_token
Expand All @@ -140,7 +140,7 @@ def csrf_token():
def csrf_protected(f):
def decorated(*args, **kwargs):
inp = web.input()
if not (inp.has_key('csrf_token') and inp.csrf_token == session.pop('csrf_token', None)):
if not ('csrf_token' in inp and inp.csrf_token == session.pop('csrf_token', None)):
raise web.HTTPError(
"400 Bad request",
{'content-type':'text/html'},
Expand Down Expand Up @@ -555,7 +555,7 @@ class DDNSIndex:
ddns_add_form = web.form.Form(web.form.Textbox('domain', web.form.notnull))
def GET(self):
try:
if session.has_key('user'):
if 'user' in session:
domains = db.query('SELECT * FROM DDNS WHERE user_id=$user_id',
vars={'user_id': session.user['ID']})
return render.ddns(domains, DDNSIndex.ddns_add_form())
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ sudo apt-get -y update &>> ${CWD}/netflix-proxy.log\
&& sudo apt-get -y install python3.6 python3-venv python3-pip sqlite3 &>> ${CWD}/netflix-proxy.log\
&& python3 -m venv venv &>> ${CWD}/netflix-proxy.log\
&& source venv/bin/activate &>> ${CWD}/netflix-proxy.log\
&& pip3 install -r requirements.txt &>> ${CWD}/netflix-proxy.log
&& pip3 install -r requirements.txt &>> ${CWD}/netflix-proxy.log\
&& pip3 install -r ${CWD}/auth/requirements.txt &>> ${CWD}/netflix-proxy.log
log_action_end_msg $?

log_action_begin_msg "configuring admin backend"
sudo pip3 install -r ${CWD}/auth/requirements.txt &>> ${CWD}/netflix-proxy.log\
&& PLAINTEXT=$(${CWD}/auth/pbkdf2_sha256_hash.py | awk '{print $1}')\
PLAINTEXT=$(${CWD}/auth/pbkdf2_sha256_hash.py | awk '{print $1}')\
&& HASH=$(${CWD}/auth/pbkdf2_sha256_hash.py ${PLAINTEXT} | awk '{print $2}')\
&& sudo cp ${CWD}/auth/db/auth.default.db ${CWD}/auth/db/auth.db &>> ${CWD}/netflix-proxy.log\
&& sudo $(which sqlite3) ${CWD}/auth/db/auth.db "UPDATE users SET password = '${HASH}' WHERE ID = 1;" &>> ${CWD}/netflix-proxy.log
Expand Down

0 comments on commit 84c2a47

Please sign in to comment.