Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signupDB = new Meteor.Collection('signup');
- Meteor.methods({
- signupSubmit : function(postData) {
- var signinEmailExist = signinDB.findOne({
- email : postData.email
- });
- if (postData.email && signinEmailExist)
- throw new Meteor.Error(422, "exist in signinDB");
- var signupEmailExist = signupDB.findOne({
- email : postData.email
- });
- if (postData.email && signupEmailExist)
- throw new Meteor.Error(422, "exist in signupDB"); //
- var user = _.extend(_.pick(postData, 'email', 'password'), {
- insert_time : new Date().getTime() });
- var userId = signupDB.insert(user);
- return userId;
- }
- });
- errorDB = new Meteor.Collection(null);
- throwError = function(data) {
- errorDB.insert({data: "in throwError", del: "N"})
- }
- Meteor.call('signupSubmit', user, function(err) {
- errorDB.insert(err);
- });
- errors = new Meteor.Collection;
- Accounts.createUser({
- email: email,
- password: password
- }, function(err) {
- errors.insert(err);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement