如果访问者没有经过身份验证,并且希望访问受保护的页面,我希望将他重定向到登录页面。我可以通过后端代码来处理这个问题,但是使用HTML更容易。我的问题是:在我的情况下使用元http-equiv安全吗?
{% block body %}
{% if user.is_authenticated %}
<meta http-equiv="REFRESH" content="0;url={{ BASE_URL }}">
{% else %}
<form method="post" action="." class="form-horizontal" role="form">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" id="btn-login" class="btn btn-success" value="Login">
<input name="next" type="hidden" value="{{next}}">
</form>
{% endif %}
{% endblock %}https://security.stackexchange.com/questions/212672
复制相似问题