Creating a new package to deal with auth and a login form

This commit is contained in:
Bruno Alves de Faria committed 2017-03-22 19:43:21 -03:00
1 parent 024e590af3
commit 1475fe9ef2
13 files changed
+218 -8

No files matched your search

@@ -0,0 +1,31 @@
import { Template } from 'meteor/templating';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
Template.userLogin.onCreated(() => {
const instance = Template.instance();
instance.api = {
login() {
// Check if the form has valid data
const form = instance.$('form').data('component');
if (!form.validate()) {
return;
}
// Get the form data
const formData = form.value();
console.warn('>>>>Logged in!', formData);
}
};
instance.schema = new SimpleSchema({
username: {
type: String,
label: 'Username'
},
password: {
type: String,
label: 'Password'
}
});
});