mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-25 08:12:39 +01:00
fix cli auth
This commit is contained in:
parent
39c084ea00
commit
8edf94b725
2 changed files with 27 additions and 39 deletions
|
@ -65,9 +65,8 @@ def index():
|
|||
ip = 0
|
||||
|
||||
# Now check the userid and idpass against the db
|
||||
print(Config.users.find({"userid": request.form.get('userid')}))
|
||||
print(Config.users.find({"userid": request.form.get('idpass')}))
|
||||
if Config.users.find({"userid": request.form["userid"]})["userid"] == request.form["userid"] and Config.users.find({"userid": request.form["userid"]})["idpass"] == request.form["idpass"]:
|
||||
try:
|
||||
if Config.users.find_one({"userid": request.form.get("userid")})["userid"] == request.form["userid"] and bcrypt.check_password_hash(Config.users.find_one({"userid": request.form.get("userid")})["idpass"], request.form.get("idpass")):
|
||||
|
||||
# Init variables before they're passed
|
||||
userid = request.form.get("userid") if request.form.get("userid") else None
|
||||
|
@ -101,6 +100,11 @@ def index():
|
|||
result, status = worker.shortenURL(url, ip, userid, id, retention)
|
||||
|
||||
return result, status
|
||||
else:
|
||||
return "Invalid userID or IDpass."
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return "Invalid userID or IDPass."
|
||||
|
||||
@app.route('/about')
|
||||
def about():
|
||||
|
|
16
install.sh
16
install.sh
|
@ -1,16 +0,0 @@
|
|||
# Might dockerise this stuff sooner or later, not now tho.
|
||||
|
||||
if [ $EUID -ne 0 ]; then
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt install mongodb-org python3-pip python3-venv
|
||||
|
||||
systemctl enable --now mongod
|
||||
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
echo "Installation complete, launch xygt with ./run.py (in the venv)"
|
Loading…
Reference in a new issue