Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/js/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ nextMeal.config(['$routeProvider', 'uiGmapGoogleMapApiProvider',
});
gmapProvider
.configure({
key: 'AIzaSyD2ozASwpbHKeG7e-5zyZbsaQN-dB1IP6s',
key: 'AIzaSyD2ozASwpbHKeG7e-5zyZbsaQN-dB1IP6s', //is this a private key?
v: '3',
libraries: 'drawing,geometry,places'
});
Expand Down
4 changes: 2 additions & 2 deletions models/organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ organizationSchema.methods.generateHash = function(password) {
organizationSchema.methods.compareHash = function(password) {
return bcrypt.compareSync(password, this.password);
};

//once again keep this consistent
organizationSchema.methods.generateFindHash = function(cb) {
var tries = 0;
var timeout;
Expand All @@ -29,7 +29,7 @@ organizationSchema.methods.generateFindHash = function(cb) {
if (err) {
if (tries > 9) {
return cb(new Error('could not generate hash'));

//get rid of this extra line
}
return timeout = setTimeout(() => {
_generateFindHash();
Expand Down
2 changes: 1 addition & 1 deletion models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const mongoose = require('mongoose');
var userSchema = new mongoose.Schema({
phone_number: { type: Number, unique: true }
});

//naming scheme is different in your model than anywhere else
module.exports = exports = mongoose.model('usersInNeed', userSchema);
5 changes: 4 additions & 1 deletion routes/auth_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ router.post('/signup', jsonParser, (req, res) => {
});
});
});

//keep the use of a blank line consistent, here you have one between other
//routes you do not. Pick one way of doing it and stick with it.
router.get('/signin', basicHTTP, (req, res) => {
Organization.findOne({ organizationName: req.auth.organizationName }, (err, user) => {
//with error messages it's usually better to give a generic error to the user
//and console.log a more detailed message
if (err) return res.status(500).json({ msg: 'authentication error' });
if (!user) return res.status(500).json({ msg: 'no user error' });
if (!user.compareHash(req.auth.password)) {
Expand Down
2 changes: 2 additions & 0 deletions routes/user_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const TwimlResponse = require('twilio').TwimlResponse;

var userRouter = module.exports = exports = Router();

//hmm you seem to have two routes with the same url
//I see a /signup in your auth router as well
userRouter.get('/signup', (req, res) => {
if (req.query.From) {
var newUser = new User({ phone_number: req.query.From });
Expand Down
1 change: 1 addition & 0 deletions routes/voice_router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const Router = require('express').Router;
const twilio = require('twilio');
//I would make this Location, since it's really a constructor/model
const location = require(__dirname + '/../models/location');
const dayFilter = require(__dirname + '/../lib/day_filter');

Expand Down