zoukankan      html  css  js  c++  java
  • 给已验证登录的用户添加访问限制

    @login_required
    def lockIndex(req):
             if not req.user.email.endswith('@example.com'):
                print req.path
                return redirect('/index')
             print 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
             print req.user.email
             print '-----------------request.user.is_authenticated()';
             print req.user.is_authenticated()
             if not req.user.is_authenticated():
                  return redirect('/index')
             print '-----------------request.user.is_authenticated()';
    
             print '---------lockIndex--------------'
             from django.conf import settings
             print req.user
             print settings.LOGIN_URL
             print '---------lockIndex--------------'
             return render_to_response('lockIndex.html')
    		 
    		 
    
    /lockIndex/
    [19/Sep/2018 12:20:44] "GET /lockIndex/ HTTP/1.1" 302 0
    [19/Sep/2018 12:20:44] "GET /index/ HTTP/1.1" 200 1190
    [19/Sep/2018 12:20:44] "GET /static/news/Css/Index/index.css HTTP/1.1" 304 0
    Not Found: /favicon.ico
    [19/Sep/2018 12:20:44] "GET /favicon.ico HTTP/1.1" 404 7449
    [19/Sep/2018 12:20:44] "GET /static/news/scan.jpg HTTP/1.1" 304 0
    [19/Sep/2018 12:20:44] "GET /static/news/login.jpg HTTP/1.1" 304 0
  • 相关阅读:
    Oracle中的exist和in
    oracle恢复误删数据
    【axios】API 说明
    Content-type对照表
    【gdal】创建GeoTiff栅格数据
    NPM使用
    【nodejs】request 和 response 对象
    【nodejs】express框架+mysql后台数据查询
    webapp网络定位
    JS对象创建的几种方法
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348982.html
Copyright © 2011-2022 走看看