Skip to content

Commit

Permalink
merge from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
seafoodbuffet committed Feb 8, 2014
2 parents 9f39074 + 87afb82 commit fb7b2bc
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 78 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ Prerequisites
- [MongoDB](http://www.mongodb.org/downloads)
- [Node.js](http://nodejs.org)
- Command Line Tools
- **Mac OS X**: [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) (or **OS X 10.9 Mavericks**: `xcode-select --install`)
- **Windows**: [Visual Studio](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-8)
- **Ubuntu**: `sudo apt-get install build-essential`
- **Fedora**: `sudo yum groupinstall "Development Tools"`
- **OpenSUSE**: `sudo zypper install --type pattern devel_basis`
- <img src="http://deluge-torrent.org/images/apple-logo.gif" height="17">&nbsp;**Mac OS X**: [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) (or **OS X 10.9 Mavericks**: `xcode-select --install`)
- <img src="http://dc942d419843af05523b-ff74ae13537a01be6cfec5927837dcfe.r14.cf1.rackcdn.com/wp-content/uploads/windows-8-50x50.jpg" height="17">&nbsp;**Windows**: [Visual Studio](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-8)
- <img src="https://lh5.googleusercontent.com/-2YS1ceHWyys/AAAAAAAAAAI/AAAAAAAAAAc/0LCb_tsTvmU/s46-c-k/photo.jpg" height="17">&nbsp;**Ubuntu**: `sudo apt-get install build-essential`
- <img src="http://i1-news.softpedia-static.com/images/extra/LINUX/small/slw218news1.png" height="17">&nbsp;**Fedora**: `sudo yum groupinstall "Development Tools"`
- <img src="https://en.opensuse.org/images/b/be/Logo-geeko_head.png" height="17">&nbsp;**OpenSUSE**: `sudo zypper install --type pattern devel_basis`

:exclamation: **Note**: If you are new to Node.js or Express framework,
I highly recommend watching [Node.js and Express 101](http://www.youtube.com/watch?v=BN0JlMZCtNU) screencast by Alex Ford that teaches Node and Express from scratch. Alternatively, here is another great tutorial for complete beginners - [Getting Started With Node.js, Express, MongoDB](http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/).
Expand Down Expand Up @@ -503,7 +503,7 @@ to "info" and "success" flash messages, and you could even create a new one your

**Data Usage Controller (Example)**
```
req.flash('warning', 'You have exceeded 90% of your data usage');
req.flash('warning', {msg: 'You have exceeded 90% of your data usage'});
```

**User Account Page (Example)**
Expand Down Expand Up @@ -846,7 +846,7 @@ TODO

Contributing
------------
If something is unclear, confusing, or needs to be refactored, please let me know. Pull requests are always welcome, but due to the opinionated nature of this project, I cannot accept every pull request. Please open an issue before submitting a pull request.
If something is unclear, confusing, or needs to be refactored, please let me know. Pull requests are always welcome, but due to the opinionated nature of this project, I cannot accept every pull request. Please open an issue before submitting a pull request. This project uses [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript) with a few exceptions.

License
-------
Expand Down
1 change: 1 addition & 0 deletions controllers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ exports.getTwilio = function(req, res, next) {
/**
* POST /api/twilio
* Twilio API example.
* @param telephone
*/

exports.postTwilio = function(req, res, next) {
Expand Down
6 changes: 3 additions & 3 deletions controllers/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ exports.getContact = function(req, res) {
/**
* POST /contact
* Send a contact form via SendGrid.
* @param {string} email
* @param {string} name
* @param {string} message
* @param email
* @param name
* @param message
*/

exports.postContact = function(req, res) {
Expand Down
37 changes: 18 additions & 19 deletions controllers/user.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var mongoose = require('mongoose');
var passport = require('passport');
var _ = require('underscore');
var User = require('../models/User');
Expand All @@ -18,8 +17,8 @@ exports.getLogin = function(req, res) {
/**
* POST /login
* Sign in using email and password.
* @param {string} email
* @param {string} password
* @param email
* @param password
*/

exports.postLogin = function(req, res, next) {
Expand Down Expand Up @@ -48,6 +47,16 @@ exports.postLogin = function(req, res, next) {
})(req, res, next);
};

/**
* GET /logout
* Log out.
*/

exports.logout = function(req, res) {
req.logout();
res.redirect('/');
};

/**
* GET /signup
* Signup page.
Expand All @@ -63,8 +72,8 @@ exports.getSignup = function(req, res) {
/**
* POST /signup
* Create a new local account.
* @param {string} email
* @param {string} password
* @param email
* @param password
*/

exports.postSignup = function(req, res, next) {
Expand Down Expand Up @@ -134,7 +143,7 @@ exports.postUpdateProfile = function(req, res, next) {
/**
* POST /account/password
* Update current password.
* @param {string} password
* @param password
*/

exports.postUpdatePassword = function(req, res, next) {
Expand Down Expand Up @@ -164,7 +173,7 @@ exports.postUpdatePassword = function(req, res, next) {
/**
* POST /account/delete
* Delete user account.
* @param {string} id
* @param id - User ObjectId
*/

exports.postDeleteAccount = function(req, res, next) {
Expand All @@ -178,8 +187,8 @@ exports.postDeleteAccount = function(req, res, next) {
/**
* GET /account/unlink/:provider
* Unlink OAuth2 provider from the current user.
* @param {string} provider
* @param {string} id
* @param provider
* @param id - User ObjectId
*/

exports.getOauthUnlink = function(req, res, next) {
Expand All @@ -197,13 +206,3 @@ exports.getOauthUnlink = function(req, res, next) {
});
});
};

/**
* GET /logout
* Log out.
*/

exports.logout = function(req, res) {
req.logout();
res.redirect('/');
};
3 changes: 1 addition & 2 deletions models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ userSchema.methods.comparePassword = function(candidatePassword, cb) {
userSchema.methods.gravatar = function(size, defaults) {
if (!size) size = 200;
if (!defaults) defaults = 'retro';
var md5 = crypto.createHash('md5');
md5.update(this.email);
var md5 = crypto.createHash('md5').update(this.email);
return 'https://gravatar.com/avatar/' + md5.digest('hex').toString() + '?s=' + size + '&d=' + defaults;
};

Expand Down
20 changes: 10 additions & 10 deletions public/js/application.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Connect Assets README (https://github.com/adunkman/connect-assets) for details
// about supported directives.
/**
* This is a manifest file that will be compiled into application.js, which will
* include all the files listed below.
*
* Any JavaScript file within this directory can be referenced here using a
* relative path.
*
* It's not advisable to add code directly here, but if you do, it will appear
* at the bottom of the compiled file.
*/

//= require lib/jquery-2.1.0.min
//= require lib/bootstrap.min
Expand Down
26 changes: 13 additions & 13 deletions views/account/login.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends ../layout
block content
.col-sm-8.col-sm-offset-2
form(method='POST')
input(type='hidden', name='_csrf', value=token)
legend Sign In
.form-group
.btn-group.btn-group-justified
Expand All @@ -22,16 +23,15 @@ block content
a.btn.btn-google-plus(href='/auth/google')
i.fa.fa-google-plus
| Google
if secrets.localAuth
.form-group
label.control-label(for='email') Email
input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true)
.form-group
label.control-label(for='password') Password
input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group
input.form-control(type='hidden', name='_csrf', value=token)
.form-group
button.btn.btn-primary(type='submit')
i.fa.fa-unlock-alt
| Login
if secrets.localAuth
.form-group
label.control-label(for='email') Email
input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true)
.form-group
label.control-label(for='password') Password
input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group
button.btn.btn-primary(type='submit')
i.fa.fa-unlock-alt
| Login

37 changes: 18 additions & 19 deletions views/account/profile.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ block content
h3 Profile Information

form.form-horizontal(action='/account/profile', method='POST')
input(type='hidden', name='_csrf', value=token)
.form-group
label.col-sm-2.control-label(for='email') Email
.col-sm-4
Expand Down Expand Up @@ -34,8 +35,6 @@ block content
label.col-sm-2.control-label(for='gravatar') Gravatar
.col-sm-4
img(src="#{user.gravatar()}", class='profile', width='100', height='100')
.form-group
input.form-control(type='hidden', name='_csrf', value=token)
.form-group
.col-sm-offset-2.col-sm-4
button.btn.btn.btn-primary(type='submit')
Expand All @@ -46,29 +45,29 @@ block content
if secrets.localAuth
.page-header
h3 Change Password

form.form-horizontal(action='/account/password', method='POST')
.form-group
label.col-sm-3.control-label(for='password') New Password
.col-sm-4
input.form-control(type='password', name='password', id='password')
.form-group
label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-4
input.form-control(type='password', name='confirmPassword', id='confirmPassword')
.form-group
input.form-control(type='hidden', name='_csrf', value=token)
.form-group
.col-sm-offset-3.col-sm-4
button.btn.btn.btn-primary(type='submit')
i.fa.fa-keyboard-o
| Change Password

form.form-horizontal(action='/account/password', method='POST')
input(type='hidden', name='_csrf', value=token)
.form-group
label.col-sm-3.control-label(for='password') New Password
.col-sm-4
input.form-control(type='password', name='password', id='password')
.form-group
label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-4
input.form-control(type='password', name='confirmPassword', id='confirmPassword')
.form-group
.col-sm-offset-3.col-sm-4
button.btn.btn.btn-primary(type='submit')
i.fa.fa-keyboard-o
| Change Password

.page-header
h3 Delete Account

p You can delete your account, but keep in mind this action is irreversible.
form(action='/account/delete', method='POST')
input(type='hidden', name='_csrf', value=token)
button.btn.btn-danger(type='submit')
i.fa.fa-trash-o
| Delete my account
Expand Down
3 changes: 1 addition & 2 deletions views/account/signup.jade
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends ../layout

block content
form.form-horizontal(id='signup-form', method='POST')
input(type='hidden', name='_csrf', value=token)
legend Signup
.form-group
label.col-sm-3.control-label(for='email') Email
Expand All @@ -15,8 +16,6 @@ block content
label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-7
input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password')
.form-group
input.form-control(type='hidden', name='_csrf', value=token)
.form-group
.col-sm-offset-3.col-sm-7
button.btn.btn-success(type='submit')
Expand Down
3 changes: 1 addition & 2 deletions views/contact.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ block content
h3 Contact Form

form.form-horizontal(role='form', method='POST')
input(type='hidden', name='_csrf', value=token)
.form-group
label(class='col-sm-2 control-label', for='name') Name
.col-sm-8
Expand All @@ -17,8 +18,6 @@ block content
label(class='col-sm-2 control-label', for='message') Body
.col-sm-8
textarea.form-control(type='text', name='message', id='message', rows='7')
.form-group
input.form-control(type='hidden', name='_csrf', value=token)
.form-group
.col-sm-offset-2.col-sm-8
button.btn.btn-default(type='submit')
Expand Down
2 changes: 1 addition & 1 deletion views/partials/navigation.jade
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if user.profile.picture
img.profile-image(src='#{user.profile.picture}')
else
img.profile-image(src='#{user.gravatar()}')
img.profile-image(src='#{user.gravatar(60)}')
| #{user.profile.name || user.email || user.id}&nbsp;
i.caret
ul.dropdown-menu
Expand Down

0 comments on commit fb7b2bc

Please sign in to comment.