fix(authentication):修复开启二次认证时,地址跳转出错问题

pull/4662/head
peijianbo 2020-09-16 16:42:04 +08:00 committed by 老广
parent 605db2d905
commit 3941539408
2 changed files with 18 additions and 46 deletions

View File

@ -26,7 +26,8 @@
{% endif %}
</div>
<div class="form-group">
<input type="password" class="form-control" id="password" name="{{ form.password.html_name }}" placeholder="{% trans 'Password' %}" required="">
<input type="password" class="form-control" id="password" placeholder="{% trans 'Password' %}" required="">
<input id="password-hidden" type="text" style="display:none" name="{{ form.password.html_name }}">
{% if form.errors.password %}
<div class="help-block field-error">
<p class="red-fonts">{{ form.errors.password.as_text }}</p>
@ -82,27 +83,12 @@
return jsencrypt.encrypt(password); //加密
}
function doLogin() {
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('服务器异常');
},
});
};
//公钥加密
var rsaPublicKey = "{{ rsa_public_key }}"
var password =$('#password').val(); //明文密码
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey)
$('#password-hidden').val(passwordEncrypted); //返回给密码输入input
$('#form').submit();//post提交
}
</script>
{% endblock %}

View File

@ -106,7 +106,8 @@
{% endif %}
</div>
<div class="form-group">
<input type="password" class="form-control" id="password" name="{{ form.password.html_name }}" placeholder="{% trans 'Password' %}" required="">
<input type="password" class="form-control" id="password" placeholder="{% trans 'Password' %}" required="">
<input id="password-hidden" type="text" style="display:none" name="{{ form.password.html_name }}">
{% if form.errors.password %}
<div class="help-block field-error">
<p class="red-fonts">{{ form.errors.password.as_text }}</p>
@ -153,28 +154,13 @@
return jsencrypt.encrypt(password); //加密
}
function doLogin() {
var rsaPublicKey = "{{ rsa_public_key }}";
var password =$('#password').val();
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey);
var serialize_array = $('#contact-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('服务器异常');
},
});
};
//公钥加密
var rsaPublicKey = "{{ rsa_public_key }}"
var password =$('#password').val(); //明文密码
var passwordEncrypted = encryptLoginPassword(password, rsaPublicKey)
$('#password-hidden').val(passwordEncrypted); //返回给密码输入input
$('#contact-form').submit();//post提交
}
</script>
</html>