Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ENCODED_USERNAME = '098f6bcd4621d373cade4e832627b4f6',
- ENCODED_PASSWORD = '5f4dcc3b5aa765d61d8327deb882cf99';
- var usernameField = document.getElementById('username'),
- passwordField = document.getElementById('password'),
- submitButton = document.getElementById('submit');
- submitButton.onclick = function() {
- var username = usernameField.value,
- password = passwordField.value;
- var usernameHash = hex_md5(username),
- passwordHash = hex_md5(password);
- if(usernameHash === ENCODED_USERNAME &&
- passwordHash === ENCODED_PASSWORD)
- {
- alert('Correct!');
- } else {
- alert('Incorrect!');
- }
- }
- /* N.B.:
- * This is a demonstration/proof of concept.
- * Of course, for multiple reasons, it is not secure enough to be used in production.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement