Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
简单身份验证的Django ratelimit不返回反向匹配_Django_Security_Python 2.7_Brute Force_Ratelimit - Fatal编程技术网

简单身份验证的Django ratelimit不返回反向匹配

简单身份验证的Django ratelimit不返回反向匹配,django,security,python-2.7,brute-force,ratelimit,Django,Security,Python 2.7,Brute Force,Ratelimit,我的目标是为大型django站点实现一些限制登录尝试的解决方案。这是我尝试使用正确/不正确的凭据登录时返回的模板错误。我正在使用django利率限制模块: 我在settings.py中包含速率限制所需的中间件 'ratelimitbackend.middleware.RateLimitMiddleware' 我将url.py配置为这样 从ratelimitbackend import admin.autodiscover开始,对于那些感兴趣的人,我最终完全抛弃了django ratelimit

我的目标是为大型django站点实现一些限制登录尝试的解决方案。这是我尝试使用正确/不正确的凭据登录时返回的模板错误。我正在使用django利率限制模块:

我在settings.py中包含速率限制所需的中间件

'ratelimitbackend.middleware.RateLimitMiddleware'

我将url.py配置为这样
从ratelimitbackend import admin.autodiscover开始,对于那些感兴趣的人,我最终完全抛弃了django ratelimit altoghter,因为它不适合,因为我使用的授权是高度定制的,不是很适合

解决方案包括为LoginAttents创建一个新模型,并为用户提供foregin密钥。然后我添加了一个信号来检测登录失败, 在Django 1.5中,是

用户登录失败


从这里开始,只需打开LoginAttests表,并将setttings.py中的限制设置为15。用户注销后,继续并将登录尝试重置为0。这不是最优雅的解决方案,但它可以工作,并且不需要任何高级配置,因为您可以使用像我这样的自定义身份验证系统

你错过了动作属性。索尔:哇,谢谢你。我想这就是为什么我是实习生。
<!-- BEGIN LOGIN FORM -->
<form class="login-form" {% url 'ratelimitbackend.views.login' %} method="post">{% csrf_token %}
    <h3 class="form-title">Sign in to your account!</h3>
    <div class="alert alert-danger display-hide">
        <button class="close" data-close="alert"></button>
        <span>
            Sorry. You're username and/or password is invalid. Please try again.
        </span>
    </div>
    <div class="form-group">
        <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
        <label class="control-label visible-ie8 visible-ie9">Username</label>
        <div class="input-icon">
            <i class="fa fa-user"></i>
            <input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="Username" name="username"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label visible-ie8 visible-ie9">Password</label>
        <div class="input-icon">
            <i class="fa fa-lock"></i>
            <input class="form-control placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="password"/>
        </div>
    </div>
    <div class="form-actions">
        <label class="checkbox">
        <input type="checkbox" name="remember" value="1"/> Remember me </label>
        <button type="submit" class="btn propagreen pull-right">
        Login <i class="m-icon-swapright m-icon-white"></i>
        </button>
    </div>
    <!-- <div class="login-options">
        <h4>Or login with</h4>
        <ul class="social-icons">
            <li>
                <a class="facebook" data-original-title="facebook" href="#">
                </a>
            </li>
            <li>
                <a class="twitter" data-original-title="Twitter" href="#">
                </a>
            </li>
            <li>
                <a class="googleplus" data-original-title="Goole Plus" href="#">
                </a>
            </li>
            <li>
                <a class="linkedin" data-original-title="Linkedin" href="#">
                </a>
            </li>
        </ul>
    </div> -->
    <div class="forget-password">
        <h4>Forgot your password ?</h4>
        <p>
             No worries! Click
            <a href="../../user/password/reset" id="forget-password">
                 here
            </a>
             to reset your password.
        </p>
    </div>
</form>
<!-- END LOGIN FORM -->