Skip to content

Instantly share code, notes, and snippets.

@djfrsn
Created August 5, 2015 02:14
Show Gist options
  • Select an option

  • Save djfrsn/42ab4b09e08f21f51147 to your computer and use it in GitHub Desktop.

Select an option

Save djfrsn/42ab4b09e08f21f51147 to your computer and use it in GitHub Desktop.
Meteor User Registration accounts-password
<template name="loginPage">
<div class="loginPage">
<h1 class=" l-brand">~:/lib</h1>
<div class="l-signup row">
<form class="col s12">
<div class="row">
<div class="input-field col s6">
<input id="userName" type="text" class="validate">
<label for="userName">Username</label>
</div>
<div class="input-field col s6">
<input id="password" type="password" class="validate">
<label for="password">Password</label>
</div>
<div class="row">
<div class="input-field col s12">
<input id="email" type="email" class="validate">
<label for="email">Email</label>
</div>
</div>
<button class="l-register btn waves-effect waves-light" type="submit" name="action">Register
</button>
</div>
</form>
</div>
</div>
</template>
Template.loginPage.events = {
"submit, click .l-register": registerUser = function ( e, t ) {
e.preventDefault();
var template = $(t.firstNode),
userName = template.find('#userName').val(),
password = template.find('#password').val(),
email = template.find('#email').val(),
formData = {
username: userName,
email: email,
password: password
};
Accounts.createUser(formData, function(error) {
debugger
if (error) {
throw new Error;
}
});
// On our submit event we will want to add
// var currentUserId = Meteor.userId();
// http://meteortips.com/first-meteor-tutorial/accounts/
}
};
// Template.loginPage.onCreated(function() {
// var instance = this;
// Session.set('slideOut',"");
// });
// Template.loginPage.onRendered(function() {
// // Initialize collapsible (uncomment the line below if you use the dropdown variation)
// //$('.collapsible').collapsible();
// });
// Template.loginPage.onDestroyed(function() {
// });
// Template.loginPage.helpers({
// userName: function() {
// return "lib";
// }
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment