Skip to content

Commit

Permalink
Merge pull request #1 from benoitsan/master
Browse files Browse the repository at this point in the history
Email Sending fixed
  • Loading branch information
Gabriel Rinaldi committed Mar 5, 2013
2 parents 6ee7ae6 + 8790cad commit 2697f42
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Below you can find Countly SDK repositories;

1. Configure the [Countly API Server](https://github.com/gabrielrinaldi/Countly-API-Heroku) first
2. Create a Heroku server (Cedar)
3. Configure this repository to push to Heroku
4. Run `heroku config:add COUNTLYDB=Your COUNTLYDB from the API server`
5. Change server on countly.common.js (`countlyCommon.READ_API_URL = "http://your_api_server/o"`)
6. Push to Heroku and you are done
3. Add [SendGrid add-on](https://addons.heroku.com/sendgrid) by running `heroku addons:add sendgrid:starter`
4. Run `heroku config:add [email protected]`
5. Configure this repository to push to Heroku
6. Run `heroku config:add COUNTLYDB=Your COUNTLYDB from the API server`
7. Change server on countly.common.js (`countlyCommon.READ_API_URL = "http://your_api_server/o"`)
8. Push to Heroku and you are done

I am using S3 now for handling app icons. You have to setup your keys for it to work:

Expand Down
12 changes: 6 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ app.post('/forgot', function(req, res, next) {
countlyDb.collection('password_reset').insert({"prid": prid, "user_id": member._id, "timestamp": timestamp}, {safe: true}, function(err, password_reset){

var transport = nodemailer.createTransport("SMTP", {
host: "smtp.sendgrid.net",
service: "SendGrid",
auth: {
user: process.env.SENDGRID_USERNAME,
pass: process.env.SENDGRID_PASSWORD
}}),
userName = (member.full_name).split(" "),
message = {
from: '"Countly"',
from: process.env.SENDGRID_SENDER,
to: req.body.email,
subject: 'Countly Account - Password Reset',
html:'Hello '+ userName[0] +',<br/><br/>'+
Expand Down Expand Up @@ -743,14 +743,14 @@ app.post('/users/create', function(req, res, next) {
countlyDb.collection('members').insert(newUser, {safe: true}, function(err, user) {
if (user && !err) {
var transport = nodemailer.createTransport("SMTP", {
host: "smtp.sendgrid.net",
service: "SendGrid",
auth: {
user: process.env.SENDGRID_USERNAME,
pass: process.env.SENDGRID_PASSWORD
}}),
userName = (req.body.full_name).split(" "),
message = {
from: '"Countly"',
from: process.env.SENDGRID_SENDER,
to: req.body.email,
subject: 'Your Countly Account',
html:'Hello '+ userName[0] +',<br/><br/>'+
Expand Down Expand Up @@ -856,14 +856,14 @@ app.post('/users/update', function(req, res, next) {

if (sendNotificationEmail) {
var transport = nodemailer.createTransport("SMTP", {
host: "smtp.sendgrid.net",
service: "SendGrid",
auth: {
user: process.env.SENDGRID_USERNAME,
pass: process.env.SENDGRID_PASSWORD
}}),
userName = (req.body.full_name).split(" "),
message = {
from: '"Countly"',
from: process.env.SENDGRID_SENDER,
to: req.body.email,
subject: 'Countly Account - Password Change',
html:'Hello '+ userName[0] +',<br/><br/>'+
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/countly/countly.device.detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
var osVersions = countlyCommon.extractBarData(_deviceDetailsDb, _os_versions, countlyDeviceDetails.clearDeviceDetailsObject);

for (var i = 0; i < osVersions.length; i++) {
osVersions[i].name = osVersions[i].name.replace(/:/g, ".").replace(/i/g, "iOS ").replace(/a/g, "Android ");
osVersions[i].name = osVersions[i].name.replace(/:/g, ".").replace(/i/g, "iOS ").replace(/m/g, "MAC ").replace(/a/g, "Android ");
}

return osVersions;
Expand All @@ -153,7 +153,7 @@

if (oSVersionData.chartData) {
for (var i = 0; i < oSVersionData.chartData.length; i++) {
oSVersionData.chartData[i].os_version = oSVersionData.chartData[i].os_version.replace(/:/g, ".").replace(/i/g, "iOS ").replace(/a/g, "Android ");
oSVersionData.chartData[i].os_version = oSVersionData.chartData[i].os_version.replace(/:/g, ".").replace(/i/g, "iOS ").replace(/m/g, "MAC ").replace(/a/g, "Android ");

if (oSVersionData.chartData[i].os_version.indexOf(osSegmentation) == -1) {
delete oSVersionData.chartData[i];
Expand Down
27 changes: 15 additions & 12 deletions public/javascripts/countly/countly.device.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,21 @@
case "iPhone3,1": fullName = "iPhone 4"; break;
case "iPhone3,3": fullName = "Verizon iPhone 4"; break;
case "iPhone4,1": fullName = "iPhone 4S"; break;
case "iPod1,1": fullName = "iPod Touch 1G"; break;
case "iPod2,1": fullName = "iPod Touch 2G"; break;
case "iPod3,1": fullName = "iPod Touch 3G"; break;
case "iPod4,1": fullName = "iPod Touch 4G"; break;
case "iPad1,1": fullName = "iPad"; break;
case "iPad2,1": fullName = "iPad 2 (WiFi)"; break;
case "iPad2,2": fullName = "iPad 2 (GSM)"; break;
case "iPad2,3": fullName = "iPad 2 (CDMA)"; break;
case "iPad2,4": fullName = "iPad 2"; break;
case "iPad3,1": fullName = "iPad-3G (WiFi)"; break;
case "iPad3,2": fullName = "iPad-3G (4G)"; break;
case "iPad3,3": fullName = "iPad-3G (4G)"; break;
case "iPhone5,1": fullName = "iPhone 5 (GSM)"; break;
case "iPhone5,2": fullName = "iPhone 5 (Global)"; break;
case "iPod1,1": fullName = "iPod Touch 1G"; break;
case "iPod2,1": fullName = "iPod Touch 2G"; break;
case "iPod3,1": fullName = "iPod Touch 3G"; break;
case "iPod4,1": fullName = "iPod Touch 4G"; break;
case "iPod5,1": fullName = "iPod Touch 5G"; break;
case "iPad1,1": fullName = "iPad"; break;
case "iPad2,1": fullName = "iPad 2 (WiFi)"; break;
case "iPad2,2": fullName = "iPad 2 (GSM)"; break;
case "iPad2,3": fullName = "iPad 2 (CDMA)"; break;
case "iPad2,4": fullName = "iPad 2"; break;
case "iPad3,1": fullName = "iPad-3G (WiFi)"; break;
case "iPad3,2": fullName = "iPad-3G (4G)"; break;
case "iPad3,3": fullName = "iPad-3G (4G)"; break;
case "i386": fullName = "Simulator"; break;
case "x86_64": fullName = "Simulator"; break;
default: fullName = shortName;
Expand Down

0 comments on commit 2697f42

Please sign in to comment.