Vulcan/client/views/users/signup.js

33 lines
789 B
JavaScript
Raw Normal View History

2013-10-09 20:53:55 +09:00
Template.signup.events = {
'click input[type=submit]': function(event){
event.preventDefault();
var username = $('#username').val();
var email = $('#email').val();
var password = $('#password').val();
2012-12-07 09:31:38 +09:00
if(!username || !email || !password){
2013-11-08 23:58:41 +01:00
throwError(i18n.t('Please fill in all fields'));
2012-12-07 09:31:38 +09:00
return false;
}
2012-10-08 18:15:01 +09:00
Accounts.createUser({
2012-08-23 09:49:41 -04:00
username: username
, email: email
2012-08-23 09:49:41 -04:00
, password: password
}, function(err){
if(err){
console.log(err);
}else{
Router.go('/');
}
2012-08-23 09:49:41 -04:00
});
2012-10-08 16:49:01 +09:00
},
2012-08-23 09:49:41 -04:00
2012-10-08 16:49:01 +09:00
'click #signin': function(){
2013-10-09 20:53:55 +09:00
Router.go('/signin');
2012-10-08 16:49:01 +09:00
},
'click .twitter-button': function(){
Meteor.loginWithTwitter(function(){
2013-10-09 20:53:55 +09:00
Router.go('/');
});
2012-08-23 09:49:41 -04:00
}
};