Skip to content

Instantly share code, notes, and snippets.

@camelcaseblog
Last active January 29, 2019 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camelcaseblog/716d857a7130307054f582834ce045db to your computer and use it in GitHub Desktop.
Save camelcaseblog/716d857a7130307054f582834ce045db to your computer and use it in GitHub Desktop.
import hashlib
from bottle import run, post, request, HTTPResponse
def check_password(username, password):
hashed_password = hashlib.md5(password.encode('utf-8')).hexdigest()
return username == "0501234567" and hashed_password == '24fdf987d78b1f6d7c6008e7ecffeefb': # md5 of 01011980
@post('/login')
def login():
if check_password(request.json['username'], request.json['password']):
return HTTPResponse(status=200)
else:
return HTTPResponse(status=401)
run(host='localhost', port=8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment