2013-11-24 16:13:53 +02:00
|
|
|
Template.signup.events({
|
2012-09-02 12:33:05 +09:00
|
|
|
'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
|
2012-09-02 12:33:05 +09:00
|
|
|
, email: email
|
2012-08-23 09:49:41 -04:00
|
|
|
, password: password
|
2012-11-26 17:11:21 +09:00
|
|
|
}, function(err){
|
2012-09-02 12:33:05 +09:00
|
|
|
if(err){
|
|
|
|
console.log(err);
|
|
|
|
}else{
|
2013-10-09 21:49:02 +09:00
|
|
|
Router.go('/');
|
2012-09-02 12:33:05 +09:00
|
|
|
}
|
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(){
|
2012-10-08 19:07:55 +09:00
|
|
|
Meteor.loginWithTwitter(function(){
|
2013-10-09 20:53:55 +09:00
|
|
|
Router.go('/');
|
2012-10-08 19:07:55 +09:00
|
|
|
});
|
2012-08-23 09:49:41 -04:00
|
|
|
}
|
2013-11-24 16:13:53 +02:00
|
|
|
});
|