Commits

ben  committed 5359668

添加login

  • Participants
  • Parent commits 24dd9b7

Comments (0)

Files changed (4)

         user = users.get_current_user()
         if user:
             return self.redirect(users.create_logout_url("/"))
+        
+class LoginHandler(PublicHandler):
+    def get(self):
+        user = users.get_current_user()
+        if user and users.is_current_user_admin() :
+            return self.redirect("/a/upload/")
+        return self.redirect(users.create_login_url("/a/upload/"))
        
 def main():
     application = webapp.WSGIApplication ([
                                        ('/e/(?P<key_name>[a-z0-9]+)/?',ImageDownloadHandler),
                                        ('/u/',ImageUploadHandler),
                                        ('/logout/',LogoutHandler),
+                                       ('/login/',LoginHandler),
                                         ],
                                          debug=settings.DEBUG)
     util.run_wsgi_app(application)

File themes/admin/base.html

 				<a href="/a/settings/">系统设置</a>|
 				<a href="/a/antileech/">防盗链</a>|
 				<a href="/a/copy/">一键复制</a>|
-				<a href="/a/api/">API设置</a>
+				<a href="/a/api/">API设置</a>|
 				<a href="/logout/">退出</a>
 			</h2>
 			{% block content %}{% endblock %}

File themes/default/base.html

 			{% block content %}{% endblock %}
         </div>
 		<div id="footer">
-                <p>Powered by <strong><a href="http://sa3.org/program/gae-album/" target="_blank" title="GAE 相册 图片">sa3album {{settings.version}}</a></strong> Hosted on Google App Engine.<a href="/a/upload/">管理登陆</a></p>
+                <p>Powered by <strong><a href="http://sa3.org/program/gae-album/" target="_blank" title="GAE 相册 图片">sa3album {{settings.version}}</a></strong> Hosted on Google App Engine.<a href="/login/">管理登陆</a></p>
 		</div>
     </body>
 </html>

File themes/gallery/base.html

 			{% block content %}{% endblock %}
         </div>
 		<div id="footer">
-                <p>Powered by <strong><a href="http://sa3.org/program/gae-album/" target="_blank" title="GAE 相册 图片">sa3album {{settings.version}}</a></strong> Hosted on Google App Engine.<a href="/a/upload/">管理登陆</a></p>
+                <p>Powered by <strong><a href="http://sa3.org/program/gae-album/" target="_blank" title="GAE 相册 图片">sa3album {{settings.version}}</a></strong> Hosted on Google App Engine.<a href="/login/">管理登陆</a></p>
 		</div>
     </body>
 </html>