Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signup() {
- if (this.signupForm.valid) {
- let user = {
- email: this.signupForm.value.email,
- password: this.signupForm.value.password,
- profile: {
- summoner: {
- summonersName: this.signupForm.value.summonersName,
- region: this.signupForm.value.region
- }
- }
- }
- Meteor.call('createUserWithRole', user, function(err, userId) {
- Meteor.loginWithPassword(user.email, user.password, function(err, success){
- this.zone.run(() => {
- if (err) {
- this.error = err;
- } else {
- this.router.navigate(['/my-profile']);
- }
- });
- });
- });
- }
- Meteor.methods({
- 'createUserWithRole': function(data) {
- //console.log(data);
- check(data, {
- email: String,
- password: String,
- profile: {
- player: {
- playersName: String,
- region: String
- }
- }
- });
- let userId;
- userId = Accounts.createUser({
- email: data.email,
- password: data.password,
- profile: {
- newHistory: false,
- player: {
- playerId: null,
- avatar: null,
- playerName: data.profile.player.playersName,
- playercname: data.profile.player.playersName.replace(/s+/g, '').toLowerCase(),
- region: data.profile.player.region,
- revisionDate: null,
- lastManualUpdate: null
- }
- }
- });
- Roles.addUsersToRoles(userId, [
- 'active',
- '1man_q',
- '2men_q',
- '3men_q',
- '4men_q',
- '5men_q',
- 'global_chat',
- 'captain',
- 'report',
- 'chat_global',
- 'chat_lobby',
- 'comment',
- 'vote',
- 'support',
- 'default'
- ], 'user_default');
- return data;
- },...others methods...skipped...
- {
- "name": "angular2-meteor-base",
- "private": true,
- "scripts": {
- "start": "meteor --settings settings-development.json",
- "start:prod": "meteor run --production",
- "build": "meteor build ./build/",
- "clear": "meteor reset",
- "meteor:update": "meteor update --all-packages",
- "test": "meteor test --driver-package practicalmeteor:mocha",
- "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
- },
- "devDependencies": {
- "@types/chai": "3.4.34",
- "@types/meteor": "^1.3.31",
- "@types/mocha": "2.2.34",
- "chai": "3.5.0",
- "chai-spies": "0.7.1",
- "meteor-node-stubs": "0.2.4"
- },
- "dependencies": {
- "@angular/common": "2.4.1",
- "@angular/compiler": "2.4.1",
- "@angular/core": "2.4.1",
- "@angular/forms": "2.4.1",
- "@angular/platform-browser": "2.4.1",
- "@angular/platform-browser-dynamic": "2.4.1",
- "@angular/router": "3.4.1",
- "angular2-meteor": "0.7.1",
- "angular2-meteor-accounts-ui": "^1.0.0",
- "angular2-meteor-polyfills": "0.1.1",
- "angular2-meteor-tests-polyfills": "0.0.2",
- "babel-runtime": "^6.18.0",
- "bootstrap": "^4.0.0-alpha.3",
- "meteor-rxjs": "0.4.7",
- "ng2-bootstrap": "^1.3.1",
- "reflect-metadata": "0.1.9",
- "rxjs": "5.0.2",
- "zone.js": "0.7.4"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement