HTTP环境下提交登录表单出现CSRF验证失败问题求助
登录表单HTTP环境提交报错,HTTPS环境正常

我的登录表单在HTTP URL下提交时会报错,但HTTPS URL下可正常工作。该代码在localhost环境下可正常运行,但在线上HTTP环境下无法工作。我已在登录表单中添加{% csrf_token %},恳请各位帮忙解决!
我的登录表单代码如下:
<form class="form-signin" method="POST" action="/signin" id="login" name="loginForm"> {% csrf_token %} <center> <a href="/"><img src="{% static 'img/LogoQW.png' %}" style="margin-bottom: 5px;" /></a> </center> <h2 class="form-signin-heading">Please log in</h2> <div style="margin-bottom: 5px;"> <a href="/register">Or click here to register</a> </div> {% if msg %} <div class="alert alert-danger" role="alert"> <strong>Error</strong> Invalid credentials or inactive account. If you have registered please make sure to activate your account by clicking on the link sent to your email address. Please check your spam folder if you are unable to find the email. </div> {% endif %} <input type="text" class="form-control" name="email" placeholder="Email Address" required="" autofocus="" ng-model="loginEmail"></input> <input type="password" class="form-control" name="password" placeholder="Password" required="" ng-model="loginPwd"></input> <button class="btn btn-lg btn-primary btn-block" type="submit" ng-click="login(loginForm.username.$viewValue, loginForm.password.$viewValue)">Log in</button> </form>
内容的提问来源于stack exchange,提问作者Pratik Sodha
相关产品推荐
相关产品推荐

