Password encryption transmission _J2EE-OA Development prior to user login submission

Source: Internet
Author: User

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




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.