Merge branch 'api-v3' into api-v3-i18n

This commit is contained in:
Blade Barringer
2015-11-13 07:44:48 -06:00
326 changed files with 11948 additions and 4147 deletions
+4 -2
View File
@@ -109,6 +109,7 @@ api.registerUser = function(req, res, next) {
// existing user, allow them to add local authentication
if (data.findFacebook) {
data.findFacebook.auth.local = newUser.auth.local;
data.findFacebook.registeredThrough = newUser.registeredThrough;
data.findFacebook.save(cb);
// new user, register them
} else {
@@ -116,6 +117,7 @@ api.registerUser = function(req, res, next) {
newUser.preferences.language = req.language; // User language detected from browser, not saved
var user = new User(newUser);
user.registeredThrough = req.headers['x-client'];
var analyticsData = {
category: 'acquisition',
type: 'local',
@@ -124,8 +126,6 @@ api.registerUser = function(req, res, next) {
};
analytics.track('register', analyticsData)
user.registeredThrough = req.headers['x-client']
user.save(function(err, savedUser){
// Clean previous email preferences
// TODO when emails added to EmailUnsubcription they should use lowercase version
@@ -203,6 +203,8 @@ api.loginSocial = function(req, res, next) {
};
user.auth[network] = prof;
user = new User(user);
user.registeredThrough = req.headers['x-client'];
user.save(function(err, savedUser){
// Clean previous email preferences
if(savedUser.auth.facebook.emails && savedUser.auth.facebook.emails[0] && savedUser.auth.facebook.emails[0].value){
+1 -1
View File
@@ -684,7 +684,7 @@ var inviteByEmails = function(invites, group, req, res, next){
// Send only status code down the line because it doesn't need
// info on invited users since they are not yet registered
res.send(200);
res.json(200, {});
}
});
};
+1 -7
View File
@@ -1,5 +1,3 @@
/* @see ./routes.coffee for routing*/
var url = require('url');
var ipn = require('paypal-ipn');
var _ = require('lodash');
@@ -65,10 +63,6 @@ var findTask = function(req, res) {
---------------
*/
/**
This is called form deprecated.coffee's score function, and the req.headers are setup properly to handle the login
Export it also so we can call it from deprecated.coffee
*/
api.score = function(req, res, next) {
var id = req.params.id,
direction = req.params.direction,
@@ -545,7 +539,7 @@ api.sessionPartyInvite = function(req,res,next){
}
/**
* All other user.ops which can easily be mapped to habitrpg-shared/index.coffee, not requiring custom API-wrapping
* All other user.ops which can easily be mapped to common/script/index.js, not requiring custom API-wrapping
*/
_.each(shared.wrap({}).ops, function(op,k){
if (!api[k]) {
@@ -1,4 +1,3 @@
/* @see ./routes.coffee for routing*/
var _ = require('lodash');
var shared = require('../../../../common');
var nconf = require('nconf');
@@ -2,7 +2,6 @@
// payment plan definitions, instead you have to create it via their REST SDK and keep it updated the same way. So this
// file will be used once for initing your billing plan (then you get the resultant plan.id to store in config.json),
// and once for any time you need to edit the plan thereafter
require('coffee-script');
var path = require('path');
var nconf = require('nconf');
_ = require('lodash');
@@ -90,4 +89,4 @@ switch(OP) {
});
break;
case "remove": break;
}
}