//encryption module
Var rsa=(function ($) {
Var publicKey
//get public
Var getPubKey=function (the callback) {
If (publicKey) return the callback ();
$.post ('/accounts/prelogin) always (function (json) {
If (json & amp; & Json. The status=='ok') {
PublicKey.=json data
If (the callback) callback ()
}
})
}
//rsa encryption
Var encrypt=function (TXT) {
if(! Return TXT publicKey)
Var rsa=new rsa. RSAKey ()
Rsa. SetPublic (publicKey. N, publicKey. E)
Var res=rsa encrypt (TXT)
Res=RSA. Linebrk (RSA) hex2b64 (res))
Return res
}
Return {
PublicKey: publicKey,
Encrypt encrypt,
GetPubKey: getPubKey
}
})(jQuery);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
KP email registered plug-in v1.0
Author: wangning1
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
; (function ($) {
$. Fn. EmailRegister=function (options) {
The options=$. The extend ({
FormEle: $(this),
MsgEle: $(this). The find (" MSG "),
SubmitUrl: $(this). Attr (' action '),
LoginIdEle: $(this). The find (" input [name='loginId'] "),
PwdEle: $(this). The find (" input [name='password'] "),
RepwdEle: $(this). The find (" input [name='repassword'] "),
CaptchaEle: $(this). The find (" input [name='captcha'] "),
Protocal: $(' # ereg - protocol),
Success: $. It
}, options);
Var ERROR_MESSAGES={
"ServerError" : "(API) in the server maintenance, please try again later",
"AccountServerError" : "(account) in the server maintenance, please try again later",
"UnknownError" : "server error",
"ClientBadParams" : "phone number format is not correct,"
"MobileExists" : "mobile phone number has been registered or other account" had already been bound to,
"SendMsgError" : "abnormal SMS server, please try again later",
"TooManyRequests" : "you of message request too much today,"
"TooOften" : "message request too frequently, please try again later",
"InvalidCode" : "invalid verification code,"
'captchaError' : 'verification code error',
"InvalidMobile" : "invalid mobile phone number, please check your input",
"EmptyPassword" : "password cannot be empty,"
"PasswordTooLong" : "password is too long,"
"NoSuchUser" : "operation fails, without the user,"
"BindMobileBefore" : "mobile phone number registered or bind other accounts",
"NeedPassword" : "user mailbox is empty, need a password",
"AnNotPassword" : "user mailbox, can't enter the password",
"SameEmailRegisteredBefore" : "this email has been registered"
};
$(' # # change - code, captcha). Click (function () {
$(" # "captcha"). Attr (' SRC ', '/captcha? "+ new Date (). GetTime ())
})
The function showMsg (Msg) {
Options. MsgEle. HTML (Msg);
}
$(this). The submit (function () {
return false;
})
$(this). The submit (function () {
If (checkLoginId () & amp; & CheckPwd () & amp; & CheckProtocol ()) {
Submit ();
}
})
The function the submit () {
Var loginId=$. Trim (options. LoginIdEle. Val ());
Var PWD=$. Trim (options. PwdEle. Val ());
Var captcha=$. Trim (options. CaptchaEle. Val ());
Rsa. GetPubKey (function () {
Var para={
'loginId: loginId.
"Password" : the PWD,
}
If (true) {
Para. Security=1;
Para. LoginId=rsa encrypt (para. LoginId);
Para. Password=rsa encrypt (para. Password);
Para. Captcha=captcha;
}
$.post (options. SubmitUrl, para, function (data) {
If (data. The status=='ok') {
Options. FormEle. The trigger (" reset ");
Options. Success (' registration ');
} else {
If (typeof ERROR_MESSAGES [data. The status]=='string') {
ShowMsg (ERROR_MESSAGES [data. The status]);
} else {
ShowMsg (' password is not correct, error code: + data, status);
}
}
}, 'json');
});
}
The function checkLoginId () {
Var loginId=$. Trim (options. LoginIdEle. Val ());
If ("===loginId) {
ShowMsg (' email address cannot be empty);
return false;
}
if (!/^ [\ w \ - \] + @ [\ w \ - \] + (. \ \ w +) + $/i.t est (loginId) & amp; & !/^ 1 \ d {10} {$/i.t est (loginId))
ShowMsg (' account number format is not correct);
return false;
}
return true;
}
//check whether agree to the registration agreement
The function checkProtocol () {
If (options. Protocal. Attr (" checked ")!=='checked') {
ShowMsg (' please read and agree to the registration agreement);
return false;
} else {
ShowMsg (' & amp; nbsp; ');
return true;
}
}
The function checkPwd () {
Var PWD=$. Trim (options. PwdEle. Val ());
Var repwd=$. Trim (options. RepwdEle. Val ());
If ("===the PWD) {
ShowMsg (' password cannot be empty);
return false;
}
If (PWD) length & lt; 6) {
ShowMsg (' password too short, not less than 6 characters');
return false;
}
If (PWD) length & gt; 32) {
ShowMsg (' password is too long, can't more than 32 characters');
return false;
}
If ("===repwd) {
ShowMsg (' confirm password cannot be empty);
return false;
}
If (PWD!=={repwd)
ShowMsg (' two passwords don't match);
return false;
}
return true;
}
}
})(jQuery);
CodePudding user response:
,RSA encryption algorithm. You see that just call interface function, real RSA algorithm didn't see it!
This kind of RSA algorithm of you find a DELPHI! Two can see each other and decryption!
CodePudding user response:
Swap http://www.cityinthesky.co.uk/here are encryptednullnull