Advertisement
Guest User

Untitled

a guest
Jan 31st, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. signup() {
  2. if (this.signupForm.valid) {
  3. let user = {
  4. email: this.signupForm.value.email,
  5. password: this.signupForm.value.password,
  6. profile: {
  7. summoner: {
  8. summonersName: this.signupForm.value.summonersName,
  9. region: this.signupForm.value.region
  10. }
  11. }
  12. }
  13. Meteor.call('createUserWithRole', user, function(err, userId) {
  14. Meteor.loginWithPassword(user.email, user.password, function(err, success){
  15. this.zone.run(() => {
  16. if (err) {
  17. this.error = err;
  18. } else {
  19. this.router.navigate(['/my-profile']);
  20. }
  21. });
  22. });
  23. });
  24. }
  25.  
  26. Meteor.methods({
  27. 'createUserWithRole': function(data) {
  28. //console.log(data);
  29. check(data, {
  30. email: String,
  31. password: String,
  32. profile: {
  33. player: {
  34. playersName: String,
  35. region: String
  36. }
  37. }
  38. });
  39. let userId;
  40. userId = Accounts.createUser({
  41. email: data.email,
  42. password: data.password,
  43. profile: {
  44. newHistory: false,
  45. player: {
  46. playerId: null,
  47. avatar: null,
  48. playerName: data.profile.player.playersName,
  49. playercname: data.profile.player.playersName.replace(/s+/g, '').toLowerCase(),
  50. region: data.profile.player.region,
  51. revisionDate: null,
  52. lastManualUpdate: null
  53. }
  54. }
  55. });
  56.  
  57. Roles.addUsersToRoles(userId, [
  58. 'active',
  59. '1man_q',
  60. '2men_q',
  61. '3men_q',
  62. '4men_q',
  63. '5men_q',
  64. 'global_chat',
  65. 'captain',
  66. 'report',
  67. 'chat_global',
  68. 'chat_lobby',
  69. 'comment',
  70. 'vote',
  71. 'support',
  72. 'default'
  73. ], 'user_default');
  74. return data;
  75. },...others methods...skipped...
  76.  
  77. {
  78. "name": "angular2-meteor-base",
  79. "private": true,
  80. "scripts": {
  81. "start": "meteor --settings settings-development.json",
  82. "start:prod": "meteor run --production",
  83. "build": "meteor build ./build/",
  84. "clear": "meteor reset",
  85. "meteor:update": "meteor update --all-packages",
  86. "test": "meteor test --driver-package practicalmeteor:mocha",
  87. "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
  88. },
  89. "devDependencies": {
  90. "@types/chai": "3.4.34",
  91. "@types/meteor": "^1.3.31",
  92. "@types/mocha": "2.2.34",
  93. "chai": "3.5.0",
  94. "chai-spies": "0.7.1",
  95. "meteor-node-stubs": "0.2.4"
  96. },
  97. "dependencies": {
  98. "@angular/common": "2.4.1",
  99. "@angular/compiler": "2.4.1",
  100. "@angular/core": "2.4.1",
  101. "@angular/forms": "2.4.1",
  102. "@angular/platform-browser": "2.4.1",
  103. "@angular/platform-browser-dynamic": "2.4.1",
  104. "@angular/router": "3.4.1",
  105. "angular2-meteor": "0.7.1",
  106. "angular2-meteor-accounts-ui": "^1.0.0",
  107. "angular2-meteor-polyfills": "0.1.1",
  108. "angular2-meteor-tests-polyfills": "0.0.2",
  109. "babel-runtime": "^6.18.0",
  110. "bootstrap": "^4.0.0-alpha.3",
  111. "meteor-rxjs": "0.4.7",
  112. "ng2-bootstrap": "^1.3.1",
  113. "reflect-metadata": "0.1.9",
  114. "rxjs": "5.0.2",
  115. "zone.js": "0.7.4"
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement