mirror of https://github.com/jumpserver/jumpserver
[Update] 修改登录验证
parent
9e4874834f
commit
74f22274b4
|
@ -81,7 +81,9 @@ function doRequestAuth() {
|
|||
url: url,
|
||||
method: "GET",
|
||||
success: function (data) {
|
||||
if (data.error !== "login_confirm_wait") {
|
||||
if (!data.error && data.msg === 'ok') {
|
||||
window.location = "{% url 'authentication:login-guard' %}"
|
||||
} else if (data.error !== "login_confirm_wait") {
|
||||
if (!errorMsgShow) {
|
||||
infoMsgRef.hide();
|
||||
errorMsgRef.show();
|
||||
|
@ -90,11 +92,7 @@ function doRequestAuth() {
|
|||
}
|
||||
clearInterval(interval);
|
||||
clearInterval(checkInterval);
|
||||
$(".copy-btn").attr('disabled', 'disabled')
|
||||
}
|
||||
if (data.msg === 'ok' && !data.error) {
|
||||
window.location = "{% url 'authentication:login-guard' %}"
|
||||
} else {
|
||||
$(".copy-btn").attr('disabled', 'disabled');
|
||||
errorMsgRef.html(data.msg)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
</div>
|
||||
{% elif form.errors.captcha %}
|
||||
<p class="red-fonts">{% trans 'Captcha invalid' %}</p>
|
||||
{% else %}
|
||||
<div style="height: 50px"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -22,7 +22,6 @@ from common.utils import get_request_ip, get_object_or_none
|
|||
from users.utils import (
|
||||
redirect_user_first_login_or_index
|
||||
)
|
||||
from ..signals import post_auth_success, post_auth_failed
|
||||
from .. import forms, mixins, errors
|
||||
|
||||
|
||||
|
@ -75,7 +74,9 @@ class UserLoginView(mixins.AuthMixin, FormView):
|
|||
form.add_error(None, e.msg)
|
||||
ip = self.get_request_ip()
|
||||
cache.set(self.key_prefix_captcha.format(ip), 1, 3600)
|
||||
context = self.get_context_data(form=form)
|
||||
new_form = self.form_class_captcha(data=form.data)
|
||||
new_form._errors = form.errors
|
||||
context = self.get_context_data(form=new_form)
|
||||
return self.render_to_response(context)
|
||||
return self.redirect_to_guard_view()
|
||||
|
||||
|
|
Loading…
Reference in New Issue