Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Nov 5, 2024
1 parent 59ae07a commit 704c454
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
13 changes: 12 additions & 1 deletion public/assets/backend/js/crypto/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,18 @@ function encryptFormPassword(formElem) {
function submitEncryptedData(formElem, onSubmitting, onSubmitted) {
$(formElem).on('submit', function (e) {
e.preventDefault();
var subtn = $(this).find(':submit');
if(subtn.children('fa-refresh').length>0) return;
var data = encryptFormPassword(this);
if (onSubmitting) data = onSubmitting(this, data);
subtn.prepend('<i class="fa fa-refresh fa-spin"></i>');
subtn.prop('disabled',true);
var end = function(){
subtn.children('.fa-refresh').remove();
subtn.prop('disabled',false);
};
$.post($(this).attr('action'), data, function (r) {
end();
if (r.Code == 1) {
if (onSubmitted) return onSubmitted(r);
if (r.URL) {
Expand All @@ -137,6 +146,8 @@ function submitEncryptedData(formElem, onSubmitting, onSubmitted) {
App.captchaUpdate($(formElem), r);
App.message({ title: App.i18n.SYS_INFO, text: r.Info ? r.Info : App.i18n.FAILURE, class_name: 'danger' });
}
}, 'json');
}, 'json').error(function(xhr,statusText,err){
end();
});
});
}
2 changes: 1 addition & 1 deletion public/assets/backend/js/crypto/helper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions public/assets/backend/js/crypto/sm2.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
function SM2Cipher(a) {
this.ct = 1;
this.sm3c3 = this.sm3keybase = this.p2 = null;
this.key = Array(32);
this.keyOff = 0;
this.cipherMode = "undefined" != typeof a ? a : SM2CipherMode.C1C3C2
}

(function (global, undefined) {
"use strict";
var SM2CipherMode = {
C1C2C3: "0",
C1C3C2: "1"
};
function SM2Cipher(a) {
this.ct = 1;
this.sm3c3 = this.sm3keybase = this.p2 = null;
this.key = Array(32);
this.keyOff = 0;
this.cipherMode = "undefined" != typeof a ? a : SM2CipherMode.C1C3C2
}
(function () {
function a(a, c) {
var b = (this._lBlock >>> a ^ this._rBlock) & c;
Expand Down Expand Up @@ -3703,7 +3704,7 @@ function sm2Encrypt(data, publickey, cipherMode) {
}
var xHex = pubkeyHex.substr(0, 64);
var yHex = pubkeyHex.substr(64);
var cipher = new SM2Cipher(cipherMode);
var cipher = new SM2.SM2Cipher(cipherMode);
var userKey = cipher.CreatePoint(xHex, yHex);
msgData = cipher.GetWords(msgData.toString());
var encryptData = cipher.Encrypt(userKey, msgData);
Expand Down
2 changes: 1 addition & 1 deletion public/assets/backend/js/crypto/sm2.min.js

Large diffs are not rendered by default.

0 comments on commit 704c454

Please sign in to comment.