GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tornado 5 · abc123nba/StarterLearningPython@492d76a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • 307.md
  • 3code/web
    • application.pyc
    • application.py
    • handlers
      • index.pyc
      • index.py
      • user.pyc
      • user.py
    • statics
      • css
        • style.css
      • js
        • script.js
    • templates
      • base.html
      • index.html
      • user.html
  • 3images
    • 30701.png
    • 30702.png
    • 30703.png
  • index.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎307.md‎

Copy file name to clipboardExpand all lines: 307.md
+283Lines changed: 283 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Large diffs are not rendered by default.
Collapse file

‎3code/web/application.py‎

Copy file name to clipboardExpand all lines: 3code/web/application.py
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
setting = dict(
1010
template_path = os.path.join(os.path.dirname(__file__), "templates"),
11-
static_path = os.path.join(os.path.dirname(__file__), "statics")
12-
)
13-
11+
static_path = os.path.join(os.path.dirname(__file__), "statics"),
12+
cookie_secret = "bZJc2sWbQLKos6GkHn/VB9oXwQt8S0R0kRvJ5/xJ89E=",
13+
xsrf_cookies = True,
14+
)
1415
application = tornado.web.Application(
1516
handlers = url,
1617
**setting
17-
)
18+
)
Collapse file

‎3code/web/application.pyc‎

Copy file name to clipboard
162 Bytes
Binary file not shown.
Collapse file

‎3code/web/handlers/index.py‎

Copy file name to clipboardExpand all lines: 3code/web/handlers/index.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def post(self):
1717
if user_infos:
1818
db_pwd = user_infos[0][2]
1919
if db_pwd == password:
20+
self.set_secure_cookie(username,db_pwd)
2021
self.write(username)
2122
else:
2223
self.write("your password was not right.")
Collapse file

‎3code/web/handlers/index.pyc‎

Copy file name to clipboard
40 Bytes
Binary file not shown.
Collapse file

‎3code/web/handlers/user.py‎

Copy file name to clipboardExpand all lines: 3code/web/handlers/user.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
class UserHandler(tornado.web.RequestHandler):
88
def get(self):
99
username = self.get_argument("user")
10+
print self.get_secure_cookie(username)
1011
user_infos = mrd.select_table(table="users",column="*",condition="username",value=username)
1112
self.render("user.html", users = user_infos)
Collapse file

‎3code/web/handlers/user.pyc‎

Copy file name to clipboard
38 Bytes
Binary file not shown.
Collapse file

‎3code/web/statics/css/style.css‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
body {
3+
color:red;
4+
}
Collapse file

‎3code/web/statics/js/script.js‎

Copy file name to clipboard
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
1+
function getCookie(name){
2+
var x = document.cookie.match("\\b" + name + "=([^;]*)\\b");
3+
return x ? x[1]:undefined;
4+
}
25
$(document).ready(function(){
36
$("#login").click(function(){
47
var user = $("#username").val();
58
var pwd = $("#password").val();
6-
var pd = {"username":user, "password":pwd};
9+
var pd = {"username":user, "password":pwd, "_xsrf":getCookie("_xsrf")};
710
$.ajax({
811
type:"post",
912
url:"/",
1013
data:pd,
1114
cache:false,
1215
success:function(data){
13-
//window.location.href = "/user?user="+data;
14-
alert(data);
16+
window.location.href = "/user?user="+data;
1517
},
1618
error:function(){
1719
alert("error!");
1820
},
1921
});
2022
});
21-
});
23+
});
Collapse file

‎3code/web/templates/base.html‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Learning Python</title>
7+
<link rel="stylesheet" type="text/css" href="{{static_url("css/style.css")}}"
8+
</head>
9+
<body>
10+
<header>
11+
{% block header %}{% end %}
12+
</header>
13+
<content>
14+
{% block body %}{% end %}
15+
</content>
16+
<footer>
17+
{% set website = "<a href='http://www.itdiffer.com'>welcome to my website</a>" %}
18+
{% raw website %}
19+
</footer>
20+
<script src="{{static_url("js/jquery.min.js")}}"></script>
21+
<script src="{{static_url("js/script.js")}}"></script>
22+
</body>
23+
</html>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.