Skip to content

Instantly share code, notes, and snippets.

@LeCoupa
Last active February 27, 2020 05:52
Show Gist options
  • Save LeCoupa/9878876 to your computer and use it in GitHub Desktop.
Save LeCoupa/9878876 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('.email').val().toLowerCase()),
password = signInForm.find('.password').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