Last active
January 29, 2019 07:32
-
-
Save camelcaseblog/716d857a7130307054f582834ce045db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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