first working version of email being sent to database

This commit is contained in:
John McLear 2013-01-30 00:33:49 +00:00
parent 5e85d1516b
commit c34b9325d6
2 changed files with 6 additions and 5 deletions

View file

@ -1,11 +1,12 @@
function sendEmailToServer(){
var email = "john@mclear.co.uk";
var userId = pad.getUserId();
var message = {};
message.type = 'USERINFO_UPDATE';
message.userInfo = {};
message.userInfo.colorId = "#0000";
message.userInfo.email = "test";
message.userInfo.userId = "FUCKING TEST";
// message.userInfo.colorId = "#0000";
message.userInfo.email = email;
message.userInfo.userId = userId;
if(email){
pad.collabClient.sendMessage(message);

View file

@ -1,4 +1,4 @@
var db = require('../../src/node/db/DB.js');
var db = require('../../src/node/db/DB').db;
API = require('../../src/node/db/API.js'),
async = require('../../src/node_modules/async'),
settings = require('../../src/node/utils/Settings');
@ -14,8 +14,8 @@ exports.handleMessage = function(hook_name, context, callback){
if (context.message && context.message.data){
if (context.message.data.type == 'USERINFO_UPDATE' ) { // if it smells okay..
if (context.message.data.userInfo){
console.warn("foo",context.message.data.userInfo);
if(context.message.data.userInfo.email){ // it contains email
exports.setAuthorEmail(
context.message.data.userInfo.userId,
context.message.data.userInfo.email, callback);