Created
December 28, 2019 18:26
-
-
Save qaisjp/b01252106ddd406c6ccfeb8cd73f6646 to your computer and use it in GitHub Desktop.
simple flask app for password redirects
This file contains hidden or 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
from flask import Flask, redirect | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Page with password form!' | |
urls = { | |
"googlepass": "https://google.com", | |
"youtubepass": "https://youtube.com" | |
} | |
@app.route('/go', methods=['POST']) | |
def go(): | |
password = request.form.get("password", "") | |
url = urls.get(password, "/404") | |
return redirect(url) | |
@app.route("/404") | |
def oops(): | |
return "Wrong password" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment