Anonymous avatar Anonymous committed 24dd9b7

添加logout

Comments (0)

Files changed (3)

                                                     method=urlfetch.POST,
                                                     )
         self.response.out.write(result.content)
-    
+        
 def main():
     application = webapp.WSGIApplication ([
                                         ('/a/', MainHandler),
 import re
 import urllib
 import fnmatch
+from google.appengine.api import users
 from google.appengine.ext import webapp
 from google.appengine.ext.webapp import util
 from django.utils import simplejson
         self.response.headers['Content-Type'] = "application/octet-stream; CHARSET=utf8"
         self.response.headers['Content-Disposition']='attachment; filename=%s' % img.name.encode('utf-8')
         self.response.out.write(img.bf)
+        
+class LogoutHandler(PublicHandler):
+    def get(self):
+        user = users.get_current_user()
+        if user:
+            return self.redirect(users.create_logout_url("/"))
        
 def main():
     application = webapp.WSGIApplication ([
                                        #('/t/(?P<key_name>[a-z0-9]+)/?',ImageResizeTestHandler),
                                        ('/e/(?P<key_name>[a-z0-9]+)/?',ImageDownloadHandler),
                                        ('/u/',ImageUploadHandler),
+                                       ('/logout/',LogoutHandler),
                                         ],
                                          debug=settings.DEBUG)
     util.run_wsgi_app(application)

themes/admin/base.html

 				<a href="/a/antileech/">防盗链</a>|
 				<a href="/a/copy/">一键复制</a>|
 				<a href="/a/api/">API设置</a>
+				<a href="/logout/">退出</a>
 			</h2>
 			{% block content %}{% endblock %}
         </div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.