Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. signupDB = new Meteor.Collection('signup');
  2.  
  3. Meteor.methods({
  4.  
  5. signupSubmit : function(postData) {
  6.  
  7. var signinEmailExist = signinDB.findOne({
  8. email : postData.email
  9. });
  10.  
  11. if (postData.email && signinEmailExist)
  12. throw new Meteor.Error(422, "exist in signinDB");
  13.  
  14. var signupEmailExist = signupDB.findOne({
  15. email : postData.email
  16. });
  17.  
  18. if (postData.email && signupEmailExist)
  19. throw new Meteor.Error(422, "exist in signupDB"); //
  20.  
  21. var user = _.extend(_.pick(postData, 'email', 'password'), {
  22. insert_time : new Date().getTime() });
  23.  
  24. var userId = signupDB.insert(user);
  25.  
  26. return userId;
  27.  
  28. }
  29.  
  30. });
  31.  
  32. errorDB = new Meteor.Collection(null);
  33.  
  34. throwError = function(data) {
  35. errorDB.insert({data: "in throwError", del: "N"})
  36. }
  37.  
  38. Meteor.call('signupSubmit', user, function(err) {
  39. errorDB.insert(err);
  40. });
  41.  
  42. errors = new Meteor.Collection;
  43.  
  44. Accounts.createUser({
  45. email: email,
  46. password: password
  47. }, function(err) {
  48. errors.insert(err);
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement