[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

JQuery question

Hi,

I need to validate a users email address (reg expression) and then encrypt it using MD5 all with JQuery.

Can any one show me an example of how I would do this ... mostly the MD5 hash thing.

Thanks
0
Eternal_Student
Asked:
Eternal_Student
1 Solution
 
leakim971PluritechnicianCommented:
>I need to validate a users email address (reg expression)
http://bassistance.de/jquery-plugins/jquery-plugin-validation/

>and then encrypt it using MD5 all with JQuery.
https://github.com/blueimp/jQuery-MD5
http://plugins.jquery.com/plugin-tags/md5
0
 
Eternal_StudentAuthor Commented:
Do you HAVE to use a plugin for the MD5 hash?

I appreciate the links but I was looking for a working example if possible?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Gurvinder Pal SinghCommented:
<<I appreciate the links but I was looking for a working example if possible?>>
something like this?
http://gtools.org/tool/md5-hash-generator/
or
http://www.webtoolkit.info/demo/javascript-md5
0
 
Eternal_StudentAuthor Commented:
HI Gurvinder,

The 1st link there (gtools) ... how is that working?
0
 
sonawanekiranCommented:
Here is code to validate email with RE. Convert it into md5 if the email is valid. You need include md5 jquery plug in attached with this



<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="jquery.md5.js" type="text/javascript"></script>

<script>
$(document).ready(function(){
     $("#btn").click(function(){
       var email =  $("#email").val();
       if (email!= "" && /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(email)) {
         $("#output").text($.md5($(this).val()));
          alert("Valid email address and below is encrypted value with jquery md5");
       }
       else {
         
         $("#output").text('');
         alert("Invalid email address");
       }
     });
  });
</script>
</head>

<body>
<input type="text" id="email">
<input type="button" id="btn" value="Validate and Convert to MD5">
 <br />
Encrypted value :  <span id="output"></span>
</body>

</html>

Open in new window

jquery.md5.js
0
 
Gurvinder Pal SinghCommented:
<<The 1st link there (gtools) ... how is that working?>>
Did you check on debugger or tried "view source"?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now