Skip to content

Instantly share code, notes, and snippets.

@qaisjp
Created December 28, 2019 18:26
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 qaisjp/b01252106ddd406c6ccfeb8cd73f6646 to your computer and use it in GitHub Desktop.
Save qaisjp/b01252106ddd406c6ccfeb8cd73f6646 to your computer and use it in GitHub Desktop.
simple flask app for password redirects
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