mirror of https://github.com/jumpserver/jumpserver
feat(authentication):登录表单仅提交时加密
parent
fe502cbe41
commit
1299f3da75
|
@ -46,7 +46,7 @@
|
|||
<div>
|
||||
{{ form.captcha }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary block full-width m-b" onclick="doLogin();return false;">{% trans 'Login' %}</button>
|
||||
<button id="submit-id" type="button" class="btn btn-primary block full-width m-b" onclick="doLogin()">{% trans 'Login' %}</button>
|
||||
|
||||
{% if demo_mode %}
|
||||
<p class="text-muted font-bold" style="color: red">
|
||||
|
@ -82,12 +82,27 @@
|
|||
return jsencrypt.encrypt(password); //加密
|
||||
}
|
||||
function doLogin() {
|
||||
//公钥加密
|
||||
var rsaPublicKey = "{{ rsa_public_key }}"
|
||||
var password =$('#password').val(); //明文密码
|
||||
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey)
|
||||
$('#password').val(passwordEncrypted); //返回给密码输入input
|
||||
$('#form').submit();//post提交
|
||||
}
|
||||
var rsaPublicKey = "{{ rsa_public_key }}";
|
||||
var password =$('#password').val();
|
||||
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey);
|
||||
var serialize_array = $('#form').serializeArray();
|
||||
$.each(serialize_array, function(index,obj){
|
||||
if(obj.name=='password'){
|
||||
obj.value=passwordEncrypted};
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '',
|
||||
data: serialize_array,
|
||||
success: function(data){
|
||||
$('body').html(data);
|
||||
},
|
||||
error: function(data){
|
||||
alert('服务器异常');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
{{ form.captcha }}
|
||||
</div>
|
||||
<div class="form-group" style="margin-top: 10px">
|
||||
<button type="submit" class="btn btn-transparent" onclick="doLogin();return false;">{% trans 'Login' %}</button>
|
||||
<button id="submit-id" type="button" class="btn btn-transparent" onclick="doLogin()">{% trans 'Login' %}</button>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<a href="{% url 'authentication:forgot-password' %}">
|
||||
|
@ -153,12 +153,27 @@
|
|||
return jsencrypt.encrypt(password); //加密
|
||||
}
|
||||
function doLogin() {
|
||||
//公钥加密
|
||||
var rsaPublicKey = "{{ rsa_public_key }}"
|
||||
var password =$('#password').val(); //明文密码
|
||||
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey)
|
||||
$('#password').val(passwordEncrypted); //返回给密码输入input
|
||||
$('#contact-form').submit();//post提交
|
||||
var rsaPublicKey = "{{ rsa_public_key }}";
|
||||
var password =$('#password').val();
|
||||
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey);
|
||||
var serialize_array = $('#form').serializeArray();
|
||||
$.each(serialize_array, function(index,obj){
|
||||
if(obj.name=='password'){
|
||||
obj.value=passwordEncrypted};
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '',
|
||||
data: serialize_array,
|
||||
success: function(data){
|
||||
$('body').html(data);
|
||||
},
|
||||
error: function(data){
|
||||
alert('服务器异常');
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue