Demand:
Because OA put on the net, in order to improve security, user login, password encryption transmission, database password encryption save.
Solution:
The front desk is encrypted with the jquery MD5 plugin, which is downloaded from the Web.
Background password encryption, with Java MD5 Tool class, this class downloaded from the Internet.
Front Desk file:
Jquery.min.js
Jquery.md5.js
There are download links, csdn download, 0 points
Code:
Click Login
$ (' #btn a '). Click (function () {
if (!$ (' #loginName '). Validatebox (' IsValid ')) {
$ (' #loginName '). Focus ();
} else if (!$ (' #password '). Validatebox (' IsValid ')) {
$ (' #password '). focus ();
} else {
//MD5 encrypted transport
Var salt= "{*nbsjt*asar#cdxd#}";
var pwd=$ (' #password '). Val ();
var md5pwd=$.md5 (pwd+salt);
$.ajax ({
URL: ' Login.manager ',
type: ' Post ',
data:{
loginname:$ (' #loginName '). Val (),
Password:md5pwd,
},
beforesend:function () {
$.messager.progress ({
text: ' Being logged in ... '
), });
},
success:function (data,response,status) {
$.messager.progress (' close ');
if (data== "Success") {
location.href = ' main.manager ';//Enter back page
}else{
$.messager.alert (' Login failed. ', ' username or password is wrong. ', ' warning ', function () {
$ (' #password '). Select ();
});
}
}
);
Background Java code:
1, with the download of/oa/src/cn/com/holychurch/common/util/md5pwdencoder.java generated MD5 into the database.
This class needs to/oa/webcontent/web-inf/lib/commons-codec-1.3.jar this jar package
There are download links, csdn download, 0 points
2, login verification, the database stored in the password and the front end of the password, if all the time, true.
Download
http://download.csdn.net/detail/zengmingen/9158097