scripts and tools to administer the lingy.in public unix / tilde
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

43 rindas
1.2KB

  1. from flask import Flask, redirect, url_for, render_template, request
  2. app=Flask(__name__)
  3. @app.route("/")
  4. def home():
  5. app.route('/')
  6. return render_template("index.html")
  7. def home2(name):
  8. # app.route('/home2/<name>')
  9. # return redirect(url_for('home'))
  10. return render_template("home.html")
  11. def success(name):
  12. return "welcome %s" % name
  13. def req():
  14. rt = {
  15. "username": "bob",
  16. "displayname": "bob",
  17. "default to display name?": "no",
  18. "email for account lockout / registration confirmation (optional)": "fuck no",
  19. "SSH public key": "123",
  20. "shell of choice": "/bin/bash",
  21. "have you read the rules?": "lolyeah"
  22. };
  23. return render_template("req.html", req_tab = rt)
  24. def login():
  25. if request.method == "POST":
  26. user = request.form["nm"]
  27. return redirect(url_for('success', name = user))
  28. else:
  29. return redirect(url_for('home'))
  30. if __name__=="__main__":
  31. app.add_url_rule('/home2/<name>', 'home2', home2)
  32. app.add_url_rule('/success/<name>', 'success', success)
  33. app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET'])
  34. app.add_url_rule('/req', 'req', req, methods = ['POST', 'GET'])
  35. app.run(host="192.168.1.228",debug=True)