Skip to content

Instantly share code, notes, and snippets.

@mjgil
Forked from LeCoupa/meteor.signin.html
Last active August 29, 2015 14:06
Show Gist options
  • Save mjgil/187be20219c6ff25e8a9 to your computer and use it in GitHub Desktop.
Save mjgil/187be20219c6ff25e8a9 to your computer and use it in GitHub Desktop.
<template name="SignIn">
<form action="/signin" id="signInForm" method="post">
<input id="signInEmail" type="text" name="email" placeholder="Email Address">
<input id="signInPassword" type="password" name="password" placeholder="Password">
<input class="btn-submit" type="submit" value="Sign In">
</form>
<!-- end #sign-in-form -->
</template>
Template.SignIn.events({
'submit #signInForm': function(e, t) {
e.preventDefault();
var signInForm = $(e.currentTarget),
email = trimInput(signInForm.find('#signInEmail').val().toLowerCase()),
password = signInForm.find('#signInPassword').val();
if (isNotEmpty(email) && isEmail(email) && isNotEmpty(password) && isValidPassword(password)) {
Meteor.loginWithPassword(email, password, function(err) {
if (err) {
console.log('These credentials are not valid.');
} else {
console.log('Welcome back Meteorite!');
}
});
}
return false;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment