Skip to content

Instantly share code, notes, and snippets.

@cdparra
Created July 30, 2013 09:49
Show Gist options
  • Save cdparra/6111666 to your computer and use it in GitHub Desktop.
Save cdparra/6111666 to your computer and use it in GitHub Desktop.
Example of Javascript code for LOGIN with a hashed password, using our an authentication service based on email/password
var sessionData = new Object;
sessionData.email = $("#email").val();
sessionData.password = $.sha1($("#password").val();
$.ajax({
type: "POST",
url: "/login",
data: JSON.stringify(sessionData),
async: false,
success: function (data) {
alert("ok");
},
error: function (data) {
alert("error");
},
dataType: "json",
contentType: "application/json"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment