Commit 3e1560b198378c418bff53d35ada4c2dddddbe1f

Authored by Ryan Glover
Exists in master

Merge branch 'feature/update_meteor_1.0.4.2_#42'

1 METEOR@1.0.3.2 1 METEOR@1.0.4.2
2 2
1 accounts-base@1.1.3 1 accounts-base@1.2.0
2 accounts-password@1.0.6 2 accounts-password@1.1.0
3 application-configuration@1.0.4 3 audit-argument-checks@1.0.3
4 audit-argument-checks@1.0.2 4 autoupdate@1.2.0
5 autoupdate@1.1.5 5 base64@1.0.3
6 base64@1.0.2 6 binary-heap@1.0.3
7 binary-heap@1.0.2 7 blaze@2.1.0
8 blaze@2.0.4 8 blaze-tools@1.0.3
9 blaze-tools@1.0.2 9 boilerplate-generator@1.0.3
10 boilerplate-generator@1.0.2 10 browser-policy@1.0.4
11 browser-policy@1.0.3 11 browser-policy-common@1.0.3
12 browser-policy-common@1.0.2 12 browser-policy-content@1.0.4
13 browser-policy-content@1.0.3 13 browser-policy-framing@1.0.4
14 browser-policy-framing@1.0.3 14 callback-hook@1.0.3
15 callback-hook@1.0.2 15 check@1.0.5
16 check@1.0.4
17 cmather:handlebars-server@2.0.0 16 cmather:handlebars-server@2.0.0
18 ddp@1.0.14 17 ddp@1.1.0
19 deps@1.0.6 18 deps@1.0.7
20 ejson@1.0.5 19 ejson@1.0.6
21 email@1.0.5 20 email@1.0.6
22 fastclick@1.0.2 21 fastclick@1.0.3
23 follower-livedata@1.0.3 22 geojson-utils@1.0.3
24 geojson-utils@1.0.2 23 handlebars@1.0.3
25 handlebars@1.0.2 24 html-tools@1.0.4
26 html-tools@1.0.3 25 htmljs@1.0.4
27 htmljs@1.0.3 26 http@1.1.0
28 http@1.0.10 27 id-map@1.0.3
29 id-map@1.0.2
30 iron:controller@1.0.7 28 iron:controller@1.0.7
31 iron:core@1.0.7 29 iron:core@1.0.7
32 iron:dynamic-template@1.0.7 30 iron:dynamic-template@1.0.7
33 iron:layout@1.0.7 31 iron:layout@1.0.7
34 iron:location@1.0.7 32 iron:location@1.0.7
35 iron:middleware-stack@1.0.7 33 iron:middleware-stack@1.0.7
36 iron:router@1.0.7 34 iron:router@1.0.7
37 iron:url@1.0.7 35 iron:url@1.0.7
38 jquery@1.11.3 36 jquery@1.11.3_2
39 json@1.0.2 37 json@1.0.3
40 launch-screen@1.0.1 38 launch-screen@1.0.2
41 livedata@1.0.12 39 livedata@1.0.13
42 localstorage@1.0.2 40 localstorage@1.0.3
43 logging@1.0.6 41 logging@1.0.7
44 meteor@1.1.4 42 meteor@1.1.5
45 meteor-platform@1.2.1 43 meteor-platform@1.2.2
46 meteorhacks:async@1.0.0 44 meteorhacks:async@1.0.0
47 meteorhacks:npm@1.2.2 45 meteorhacks:npm@1.3.0
48 minifiers@1.1.3 46 minifiers@1.1.4
49 minimongo@1.0.6 47 minimongo@1.0.7
50 mobile-status-bar@1.0.2 48 mobile-status-bar@1.0.3
51 mongo@1.0.11 49 mongo@1.1.0
52 npm-bcrypt@0.7.7 50 npm-bcrypt@0.7.8_1
53 npm-container@1.0.0 51 npm-container@1.0.0
54 observe-sequence@1.0.4 52 observe-sequence@1.0.5
55 ordered-dict@1.0.2 53 ordered-dict@1.0.3
56 particle4dev:sass@0.3.0 54 particle4dev:sass@0.3.0
57 random@1.0.2 55 random@1.0.3
58 reactive-dict@1.0.5 56 reactive-dict@1.1.0
59 reactive-var@1.0.4 57 reactive-var@1.0.5
60 reload@1.1.2 58 reload@1.1.3
61 retry@1.0.2 59 retry@1.0.3
62 routepolicy@1.0.4 60 routepolicy@1.0.5
63 service-configuration@1.0.3 61 service-configuration@1.0.4
64 session@1.0.5 62 session@1.1.0
65 sha@1.0.2 63 sha@1.0.3
66 spacebars@1.0.5 64 spacebars@1.0.6
67 spacebars-compiler@1.0.4 65 spacebars-compiler@1.0.5
68 srp@1.0.2 66 srp@1.0.3
69 standard-app-packages@1.0.4 67 standard-app-packages@1.0.5
70 templating@1.0.11 68 templating@1.1.0
71 themeteorchef:bert@1.0.2 69 themeteorchef:bert@1.0.2
72 themeteorchef:jquery-validation@1.13.1 70 themeteorchef:jquery-validation@1.13.1
73 tracker@1.0.5 71 tracker@1.0.6
74 twbs:bootstrap@3.3.2 72 twbs:bootstrap@3.3.4
75 ui@1.0.5 73 ui@1.0.6
76 underscore@1.0.2 74 underscore@1.0.3
77 url@1.0.3 75 url@1.0.4
78 webapp@1.1.6 76 webapp@1.2.0
79 webapp-hashing@1.0.2 77 webapp-hashing@1.0.3
80 78
1 # The Meteor Chef - Base (@1.0.3.2) 1 # The Meteor Chef - Base (@1.0.4.2)
2 A starting point for Meteor apps. 2 A starting point for Meteor apps.
3 3
4 Base is the lazy person's starter kit for Meteor. It includes some commonly used packages (biased to The Meteor Chef) and code for common functionality. This is the starter kit for all Meteor Chef recipes. 4 Base is the lazy person's starter kit for Meteor. It includes some commonly used packages (biased to The Meteor Chef) and code for common functionality. This is the starter kit for all Meteor Chef recipes.
5 5
6 For more detail on updates, [read the Changelog](https://github.com/themeteorchef/base/wiki/Changelog). If you're interested in contributing to Base, checkout the [Contribution wiki](https://github.com/themeteorchef/base/wiki/Contributing-to-Base) to get started. 6 For more detail on updates, [read the Changelog](https://github.com/themeteorchef/base/wiki/Changelog). If you're interested in contributing to Base, checkout the [Contribution wiki](https://github.com/themeteorchef/base/wiki/Contributing-to-Base) to get started.
7 7
8 ### Packages Included 8 ### Packages Included
9 - Accounts (Base) - `meteor add accounts-base` 9 - Accounts (Base) - `meteor add accounts-base`
10 - Accounts (Password) - `meteor add accounts-password` 10 - Accounts (Password) - `meteor add accounts-password`
11 - Audit Argument Checks - `meteor add audit-argument-checks` 11 - Audit Argument Checks - `meteor add audit-argument-checks`
12 - Bert - `meteor add themeteorchef:bert` 12 - Bert - `meteor add themeteorchef:bert`
13 - Bootstrap 3 - `meteor add twbs:bootstrap` 13 - Bootstrap 3 - `meteor add twbs:bootstrap`
14 - Browser Policy - `meteor add browser-policy` 14 - Browser Policy - `meteor add browser-policy`
15 - Check - `meteor add check` 15 - Check - `meteor add check`
16 - Handlebars Server - `meteor add cmather:handlebars-server` 16 - Handlebars Server - `meteor add cmather:handlebars-server`
17 - Iron Router - `meteor add iron:router` 17 - Iron Router - `meteor add iron:router`
18 - jQuery - `meteor add jquery` 18 - jQuery - `meteor add jquery`
19 - jQuery Validation - `meteor add themeteorchef:jquery-validation` 19 - jQuery Validation - `meteor add themeteorchef:jquery-validation`
20 - NPM - `meteor add meteorhacks:npm` 20 - NPM - `meteor add meteorhacks:npm`
21 - Sass - `meteor add particle4dev:sass@0.3.0` 21 - Sass - `meteor add particle4dev:sass@0.3.0`
22 - Underscore - `meteor add underscore` 22 - Underscore - `meteor add underscore`
23 23
24 **Note:** Base also supports loading NPM packages using the `meteorhacks:npm` package. To load NPM packages, add name and version information to `/packages.json` and inside of your file (server only), load the package with `var package = Meteor.npmRequire('package-name');`. For more information, see the [meteorhacks:npm documentation](https://github.com/meteorhacks/npm/). 24 **Note:** Base also supports loading NPM packages using the `meteorhacks:npm` package. To load NPM packages, add name and version information to `/packages.json` and inside of your file (server only), load the package with `var package = Meteor.npmRequire('package-name');`. For more information, see the [meteorhacks:npm documentation](https://github.com/meteorhacks/npm/).
25 25
26 ### File Structure 26 ### File Structure
27 Base comes with a pre-defined file structure common to all projects along with some skeleton files for getting started quickly. Here's what it looks like: 27 Base comes with a pre-defined file structure common to all projects along with some skeleton files for getting started quickly. Here's what it looks like:
28 28
29 ``` 29 ```
30 /root 30 /root
31 ---/.meteor 31 ---/.meteor
32 ---/client 32 ---/client
33 ------/controllers 33 ------/controllers
34 ---------/authenticated 34 ---------/authenticated
35 ------------header.js 35 ------------header.js
36 ---------/public 36 ---------/public
37 ------------login.js 37 ------------login.js
38 ------------recover-password.js 38 ------------recover-password.js
39 ------------reset-password.js 39 ------------reset-password.js
40 ------------signup.js 40 ------------signup.js
41 ------/helpers 41 ------/helpers
42 ---------helpers-ui.js 42 ---------helpers-ui.js
43 ------/includes 43 ------/includes
44 ---------_header.html 44 ---------_header.html
45 ------/layouts 45 ------/layouts
46 ---------layout-default.html 46 ---------layout-default.html
47 ------/routes 47 ------/routes
48 ---------hooks.js 48 ---------hooks.js
49 ---------routes-authenticated.js 49 ---------routes-authenticated.js
50 ---------routes-global.js 50 ---------routes-global.js
51 ---------routes-public.js 51 ---------routes-public.js
52 ------/stylesheets 52 ------/stylesheets
53 ---------/sass 53 ---------/sass
54 ------------/globals 54 ------------/globals
55 ---------------_extends.scss 55 ---------------_extends.scss
56 ------------/views 56 ------------/views
57 ---------------/public 57 ---------------/public
58 ------------------_login.scss 58 ------------------_login.scss
59 ---------application.scss 59 ---------application.scss
60 -------/views 60 -------/views
61 ---------/authenticated 61 ---------/authenticated
62 ------------index.html 62 ------------index.html
63 ---------/public 63 ---------/public
64 ------------loading.html 64 ------------loading.html
65 ------------login.html 65 ------------login.html
66 ------------not-found.html 66 ------------not-found.html
67 ------------recover-password.html 67 ------------recover-password.html
68 ------------reset-password.html 68 ------------reset-password.html
69 ------------signup.html 69 ------------signup.html
70 ---/collections 70 ---/collections
71 ------example.js 71 ------example.js
72 ------users.js 72 ------users.js
73 ---/packages 73 ---/packages
74 ------ (See List Above) 74 ------ (See List Above)
75 ---/public 75 ---/public
76 ------/images 76 ------/images
77 ---/server 77 ---/server
78 ------/admin 78 ------/admin
79 ---------/startup-functions 79 ---------/startup-functions
80 ------------browser-policies.js 80 ------------browser-policies.js
81 ------------test-accounts.js 81 ------------test-accounts.js
82 ---------startup.js 82 ---------startup.js
83 ------/email 83 ------/email
84 ---------/templates 84 ---------/templates
85 ------------reset-password.js 85 ------------reset-password.js
86 ------/methods 86 ------/methods
87 ---------/insert 87 ---------/insert
88 ------------example.js 88 ------------example.js
89 ---------/read 89 ---------/read
90 ------------example.js 90 ------------example.js
91 ---------/remove 91 ---------/remove
92 ------------example.js 92 ------------example.js
93 ---------/update 93 ---------/update
94 ------------example.js 94 ------------example.js
95 ---------/utility 95 ---------/utility
96 ------------example.js 96 ------------example.js
97 ------/publications 97 ------/publications
98 ---------example.js 98 ---------example.js
99 ---.editorconfig 99 ---.editorconfig
100 ---.gitignore 100 ---.gitignore
101 ---application.html 101 ---application.html
102 ---package.json 102 ---package.json
103 ---packages.json 103 ---packages.json
104 ---README.MD (this file) 104 ---README.MD (this file)
105 ---settings-development.json 105 ---settings-development.json
106 ---settings-production.json 106 ---settings-production.json
107 ---smart.json (added by Meteor) 107 ---smart.json (added by Meteor)
108 ---smart.lock (added by Meteor) 108 ---smart.lock (added by Meteor)
109 ``` 109 ```
110 110
111 ### JavaScript & CSS 111 ### JavaScript & CSS
112 Prior to v2.0.0, Base was written in CoffeeScript. At the request of the community, Base was ported _back_ to native JavaScript. 112 Prior to v2.0.0, Base was written in CoffeeScript. At the request of the community, Base was ported _back_ to native JavaScript.
113 113
114 CSS in Base is written using [Sass](http://sass-lang.com). 114 CSS in Base is written using [Sass](http://sass-lang.com).
115 115
116 ### Functionality 116 ### Functionality
117 117
118 ###### Configuration 118 ###### Configuration
119 Base includes a pattern for managing your API keys, connection strings, and other configuration information using two files: `settings-development.json` and `settings-production.json`. This pattern separates your development and production configuration into two separate files for the sake of security. 119 Base includes a pattern for managing your API keys, connection strings, and other configuration information using two files: `settings-development.json` and `settings-production.json`. This pattern separates your development and production configuration into two separate files for the sake of security.
120 120
121 Per [Josh Owen's article](http://joshowens.me/environment-settings-and-security-with-meteor-js/), it's considered "bad practice" to check your production keys into your repo (private or otherwise). Base accounts for this by giving you two separate files, but also specifies that your `settings-production.json` file should be ignored by git in `.gitignore`. 121 Per [Josh Owen's article](http://joshowens.me/environment-settings-and-security-with-meteor-js/), it's considered "bad practice" to check your production keys into your repo (private or otherwise). Base accounts for this by giving you two separate files, but also specifies that your `settings-production.json` file should be ignored by git in `.gitignore`.
122 122
123 This means that keys that are only used for testing or development purposes can be placed in `settings-development.json`, while keys used in your production application should be placed in `settings-production.json`. Sharing and management of `settings-production.json` should be done on a person-to-person basis and _not_ made globally accessible. 123 This means that keys that are only used for testing or development purposes can be placed in `settings-development.json`, while keys used in your production application should be placed in `settings-production.json`. Sharing and management of `settings-production.json` should be done on a person-to-person basis and _not_ made globally accessible.
124 124
125 ###### Startup & Deployment 125 ###### Startup & Deployment
126 A tip picked up from [Gerard Sychay at Differential](http://blog.differential.com/use-package-json-in-your-meteor-app-for-fun-profit/), Base makes use of the NPM `package.json` convention to make startup and deployment super easy. Within `package.json`, three scripts have been defined for you: 126 A tip picked up from [Gerard Sychay at Differential](http://blog.differential.com/use-package-json-in-your-meteor-app-for-fun-profit/), Base makes use of the NPM `package.json` convention to make startup and deployment super easy. Within `package.json`, three scripts have been defined for you:
127 127
128 1. `npm start` - Starts your Meteor server locally with `settings-development.json` in tow. Equivalent to typing out `meteor --settings settings-development.json`. 128 1. `npm start` - Starts your Meteor server locally with `settings-development.json` in tow. Equivalent to typing out `meteor --settings settings-development.json`.
129 2. `npm staging` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Staging" environment. This requires you to have a Modulus account set up and a server titled "Staging" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-development.json` file so you don't have to do it by hand. 129 2. `npm staging` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Staging" environment. This requires you to have a Modulus account set up and a server titled "Staging" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-development.json` file so you don't have to do it by hand.
130 3. `npm production` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Production" environment. This requires you to have a Modulus account set up and a server titled "Production" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-production.json` file so you don't have to do it by hand. 130 3. `npm production` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Production" environment. This requires you to have a Modulus account set up and a server titled "Production" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-production.json` file so you don't have to do it by hand.
131 131
132 ###### Bootstrap (@3.2.1) 132 ###### Bootstrap (@3.2.1)
133 Base makes use of the [Bootstrap](http://getbootstrap.com) front-end Framework. It may not be your bag of chips and is *definitely not required*. If you want to swap it out, you'll need to unhook the markup in each of the included template files in `/client/views` and uninstall the `twbs:bootstrap` package by running `meteor remove twbs:bootstrap` in your terminal. 133 Base makes use of the [Bootstrap](http://getbootstrap.com) front-end Framework. It may not be your bag of chips and is *definitely not required*. If you want to swap it out, you'll need to unhook the markup in each of the included template files in `/client/views` and uninstall the `twbs:bootstrap` package by running `meteor remove twbs:bootstrap` in your terminal.
134 134
135 In respect to UI, Base uses Bootstrap's `.navbar` element, as well as its `.container` and a few `.row`/`.col-<size>-<columns>` wrappers. You'll also find the `.btn` class and its modifiers (`.success, .warning, etc.`) in use throughout the app. All of these implementations are merely presentational and can be changed (or removed) as you see fit. 135 In respect to UI, Base uses Bootstrap's `.navbar` element, as well as its `.container` and a few `.row`/`.col-<size>-<columns>` wrappers. You'll also find the `.btn` class and its modifiers (`.success, .warning, etc.`) in use throughout the app. All of these implementations are merely presentational and can be changed (or removed) as you see fit.
136 136
137 ###### Basic Routing 137 ###### Basic Routing
138 Base comes with a collection of pre-defined routes and templates for common functionality. Base also includes a set of common route filters for managing user access. Routes bundled include: 138 Base comes with a collection of pre-defined routes and templates for common functionality. Base also includes a set of common route filters for managing user access. Routes bundled include:
139 139
140 ``` 140 ```
141 - / (Authenticated) 141 - / (Authenticated)
142 - /login (Public) 142 - /login (Public)
143 - /recover-password (Public) 143 - /recover-password (Public)
144 - /reset-password (Public) 144 - /reset-password (Public)
145 - /signup (Public) 145 - /signup (Public)
146 ``` 146 ```
147 147
148 A UI helper called `currentRoute` has been added to Base which allows you to add an `active` class to menu items in your navigation to reflect the user's current location. 148 A UI helper called `currentRoute` has been added to Base which allows you to add an `active` class to menu items in your navigation to reflect the user's current location.
149 149
150 A collection of hooks has also been added to Base to control route access based on different conditions (e.g. whether a user is logged in or not). 150 A collection of hooks has also been added to Base to control route access based on different conditions (e.g. whether a user is logged in or not).
151 151
152 ###### Authentication 152 ###### Authentication
153 Base includes a complete authentication pattern complete with: 153 Base includes a complete authentication pattern complete with:
154 154
155 - Login (at /login) 155 - Login (at /login)
156 - Logout (no path, implemented as a dropdown item/click event in /client/controllers/header.js) 156 - Logout (no path, implemented as a dropdown item/click event in /client/controllers/header.js)
157 - Password Recovery (at /recover-password and /reset-password) 157 - Password Recovery (at /recover-password and /reset-password)
158 - Signup (at /signup) 158 - Signup (at /signup)
159 159
160 ###### Example Collection/Publication/Subscription 160 ###### Example Collection/Publication/Subscription
161 Base includes a collection called `Example`, along with a publication and subscription pattern to show moving data from the server to the client. Publications are defined in `/server/publications/example.js` and a subscription is demonstrated on the `index` route in `/client/routes/routes-authenticated.js`. 161 Base includes a collection called `Example`, along with a publication and subscription pattern to show moving data from the server to the client. Publications are defined in `/server/publications/example.js` and a subscription is demonstrated on the `index` route in `/client/routes/routes-authenticated.js`.
162 162
163 ###### Validation 163 ###### Validation
164 Base includes support for client-side validation via [jQuery Validation](http://jqueryvalidation.org). Validation is provided for all public templates: login, signup, recover password, and reset password. 164 Base includes support for client-side validation via [jQuery Validation](http://jqueryvalidation.org). Validation is provided for all public templates: login, signup, recover password, and reset password.
165 165
166 ###### Alerts 166 ###### Alerts
167 Base includes support for fixed bar (top and bottom) and growl-style alerts on the client via [`themeteorchef:bert`](https://atmospherejs.com/themeteorchef/bert). 167 Base includes support for fixed bar (top and bottom) and growl-style alerts on the client via [`themeteorchef:bert`](https://atmospherejs.com/themeteorchef/bert).
168 168
169 ###### Automatic Admin User Creation 169 ###### Automatic Admin User Creation
170 When developing, having a handful of user accounts to test your application with can come in handy. Base comes with an automated account generation script located in `server/admin/startup.js` that creates accounts based on an array of specified users. **Note: by default this creates one Admin user on server startup, so make sure to customize or remove this user so the public can't access your app**. 170 When developing, having a handful of user accounts to test your application with can come in handy. Base comes with an automated account generation script located in `server/admin/startup.js` that creates accounts based on an array of specified users. **Note: by default this creates one Admin user on server startup, so make sure to customize or remove this user so the public can't access your app**.
171 171
client/controllers/authenticated/header.js
1 /* 1 /*
2 * Controller: Header 2 * Controller: Header
3 * Template: /client/includes/_header.html 3 * Template: /client/includes/_header.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.header.created = function(){ 10 Template.header.onCreated(function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 });
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.header.rendered = function() { 18 Template.header.onRendered(function() {
19 // Code to run when template is rendered goes here. 19 // Code to run when template is rendered goes here.
20 } 20 });
21 21
22 /* 22 /*
23 * Helpers 23 * Helpers
24 */ 24 */
25 25
26 Template.header.helpers({ 26 Template.header.helpers({
27 example: function(){ 27 example: function(){
28 // Code to run for helper function. 28 // Code to run for helper function.
29 } 29 }
30 }); 30 });
31 31
32 /* 32 /*
33 * Events 33 * Events
34 */ 34 */
35 35
36 Template.header.events({ 36 Template.header.events({
37 'click .logout': function(){ 37 'click .logout': function(){
38 Meteor.logout(function(error){ 38 Meteor.logout(function(error){
39 if(error){ 39 if(error){
40 Bert.alert(error.reason, 'danger'); 40 Bert.alert(error.reason, 'danger');
41 } else { 41 } else {
42 Bert.alert('Succesfully logged out!', 'success'); 42 Bert.alert('Succesfully logged out!', 'success');
43 } 43 }
44 }); 44 });
45 } 45 }
46 }); 46 });
47 47
client/controllers/public/login.js
1 /* 1 /*
2 * Controller: Login 2 * Controller: Login
3 * Template: /client/views/public/login.html 3 * Template: /client/views/public/login.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.login.created = function(){ 10 Template.login.onCreated(function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 });
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.login.rendered = function(){ 18 Template.login.onRendered(function(){
19 $('#application-login').validate({ 19 $('#application-login').validate({
20 rules: { 20 rules: {
21 emailAddress: { 21 emailAddress: {
22 required: true, 22 required: true,
23 email: true 23 email: true
24 }, 24 },
25 password: { 25 password: {
26 required: true 26 required: true
27 } 27 }
28 }, 28 },
29 messages: { 29 messages: {
30 emailAddress: { 30 emailAddress: {
31 required: "Please enter your email address to login.", 31 required: "Please enter your email address to login.",
32 email: "Please enter a valid email address." 32 email: "Please enter a valid email address."
33 }, 33 },
34 password: { 34 password: {
35 required: "Please enter your password to login." 35 required: "Please enter your password to login."
36 } 36 }
37 }, 37 },
38 submitHandler: function(){ 38 submitHandler: function(){
39 // Grab the user's details. 39 // Grab the user's details.
40 user = { 40 user = {
41 email: $('[name="emailAddress"]').val(), 41 email: $('[name="emailAddress"]').val(),
42 password: $('[name="password"]').val() 42 password: $('[name="password"]').val()
43 } 43 }
44 44
45 // Log the user in. 45 // Log the user in.
46 Meteor.loginWithPassword(user.email, user.password, function(error){ 46 Meteor.loginWithPassword(user.email, user.password, function(error){
47 if(error){ 47 if(error){
48 Bert.alert(error.reason, 'danger'); 48 Bert.alert(error.reason, 'danger');
49 } else { 49 } else {
50 Bert.alert('Logged in!', 'success'); 50 Bert.alert('Logged in!', 'success');
51 } 51 }
52 }); 52 });
53 } 53 }
54 }); 54 });
55 } 55 });
56 56
57 /* 57 /*
58 * Helpers 58 * Helpers
59 */ 59 */
60 60
61 Template.login.helpers({ 61 Template.login.helpers({
62 example: function(){ 62 example: function(){
63 // Code to run for helper function. 63 // Code to run for helper function.
64 } 64 }
65 }); 65 });
66 66
67 /* 67 /*
68 * Events 68 * Events
69 */ 69 */
70 70
71 Template.login.events({ 71 Template.login.events({
72 'submit form': function(e){ 72 'submit form': function(e){
73 // Prevent form from submitting. 73 // Prevent form from submitting.
74 e.preventDefault(); 74 e.preventDefault();
75 } 75 }
76 }); 76 });
77 77
client/controllers/public/recover-password.js
1 /* 1 /*
2 * Controller: Recover Password 2 * Controller: Recover Password
3 * Template: /client/views/public/recover-password.html 3 * Template: /client/views/public/recover-password.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.recoverPassword.created = function(){ 10 Template.recoverPassword.onCreated(function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 });
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 18
19 Template.recoverPassword.rendered = function(){ 19 Template.recoverPassword.onRendered(function(){
20 $('#application-recover-password').validate({ 20 $('#application-recover-password').validate({
21 rules: { 21 rules: {
22 emailAddress: { 22 emailAddress: {
23 required: true, 23 required: true,
24 email: true 24 email: true
25 } 25 }
26 }, 26 },
27 messages: { 27 messages: {
28 emailAddress: { 28 emailAddress: {
29 required: "Please enter your email address to recover your password.", 29 required: "Please enter your email address to recover your password.",
30 email: "Please enter a valid email address." 30 email: "Please enter a valid email address."
31 } 31 }
32 }, 32 },
33 submitHandler: function(){ 33 submitHandler: function(){
34 // Grab the user's email address. 34 // Grab the user's email address.
35 var email = $('[name="emailAddress"]').val(); 35 var email = $('[name="emailAddress"]').val();
36 36
37 // Call the send reset password email method. 37 // Call the send reset password email method.
38 Accounts.forgotPassword({email: email}, function(error){ 38 Accounts.forgotPassword({email: email}, function(error){
39 if(error){ 39 if(error){
40 Bert.alert(error.reason, 'danger'); 40 Bert.alert(error.reason, 'danger');
41 } else { 41 } else {
42 Bert.alert('Check your inbox for a reset link!', 'success'); 42 Bert.alert('Check your inbox for a reset link!', 'success');
43 } 43 }
44 }); 44 });
45 } 45 }
46 }); 46 });
47 } 47 });
48 48
49 /* 49 /*
50 * Helpers 50 * Helpers
51 */ 51 */
52 52
53 Template.recoverPassword.helpers({ 53 Template.recoverPassword.helpers({
54 example: function(){ 54 example: function(){
55 // Code to run for helper function. 55 // Code to run for helper function.
56 } 56 }
57 }); 57 });
58 58
59 /* 59 /*
60 * Events 60 * Events
61 */ 61 */
62 62
63 Template.recoverPassword.events({ 63 Template.recoverPassword.events({
64 'submit form': function(e){ 64 'submit form': function(e){
65 // Prevent form from submitting. 65 // Prevent form from submitting.
66 e.preventDefault(); 66 e.preventDefault();
67 } 67 }
68 }); 68 });
69 69
client/controllers/public/reset-password.js
1 /* 1 /*
2 * Controller: Reset Password 2 * Controller: Reset Password
3 * Template: /client/views/public/reset-password.html 3 * Template: /client/views/public/reset-password.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.resetPassword.created = function(){ 10 Template.resetPassword.onCreated(function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 });
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.resetPassword.rendered = function(){ 18 Template.resetPassword.onRendered(function(){
19 $('#application-reset-password').validate({ 19 $('#application-reset-password').validate({
20 rules: { 20 rules: {
21 newPassword: { 21 newPassword: {
22 required: true, 22 required: true,
23 minlength: 6 23 minlength: 6
24 }, 24 },
25 repeatNewPassword: { 25 repeatNewPassword: {
26 required: true, 26 required: true,
27 minlength: 6, 27 minlength: 6,
28 equalTo: "[name='newPassword']" 28 equalTo: "[name='newPassword']"
29 } 29 }
30 }, 30 },
31 messages: { 31 messages: {
32 newPassword: { 32 newPassword: {
33 required: "Please enter a new password.", 33 required: "Please enter a new password.",
34 minlength: "Please use at least six characters." 34 minlength: "Please use at least six characters."
35 }, 35 },
36 repeatNewPassword: { 36 repeatNewPassword: {
37 required: "Please repeat your new password.", 37 required: "Please repeat your new password.",
38 equalTo: "Your password do not match. Please try again." 38 equalTo: "Your password do not match. Please try again."
39 } 39 }
40 }, 40 },
41 submitHandler: function(){ 41 submitHandler: function(){
42 // Grab the user's reset token and new password. 42 // Grab the user's reset token and new password.
43 var token = Session.get('resetPasswordToken'), 43 var token = Session.get('resetPasswordToken'),
44 password = $('[name="newPassword"]').val(); 44 password = $('[name="newPassword"]').val();
45 45
46 // Reset the user's password. 46 // Reset the user's password.
47 Accounts.resetPassword(token, password, function(error){ 47 Accounts.resetPassword(token, password, function(error){
48 if(error){ 48 if(error){
49 Bert.alert(error.reason, 'danger'); 49 Bert.alert(error.reason, 'danger');
50 } else { 50 } else {
51 Bert.alert('Password successfully reset!', 'success'); 51 Bert.alert('Password successfully reset!', 'success');
52 Session.set('resetPasswordToken', null); 52 Session.set('resetPasswordToken', null);
53 } 53 }
54 }); 54 });
55 } 55 }
56 }); 56 });
57 } 57 });
58 58
59 /* 59 /*
60 * Helpers 60 * Helpers
61 */ 61 */
62 62
63 Template.resetPassword.helpers({ 63 Template.resetPassword.helpers({
64 example: function(){ 64 example: function(){
65 // Code to run for helper function. 65 // Code to run for helper function.
66 } 66 }
67 }); 67 });
68 68
69 /* 69 /*
70 * Events 70 * Events
71 */ 71 */
72 72
73 Template.resetPassword.events({ 73 Template.resetPassword.events({
74 'submit form': function(e){ 74 'submit form': function(e){
75 // Prevent form from submitting. 75 // Prevent form from submitting.
76 e.preventDefault(); 76 e.preventDefault();
77 } 77 }
78 }); 78 });
79 79
client/controllers/public/signup.js
1 /* 1 /*
2 * Controller: Signup 2 * Controller: Signup
3 * Template: /client/views/public/signup.html 3 * Template: /client/views/public/signup.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.signup.created = function(){ 10 Template.signup.onCreated(function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 });
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.signup.rendered = function(){ 18 Template.signup.onRendered(function(){
19 $('#application-signup').validate({ 19 $('#application-signup').validate({
20 rules: { 20 rules: {
21 emailAddress: { 21 emailAddress: {
22 required: true, 22 required: true,
23 email: true 23 email: true
24 }, 24 },
25 password: { 25 password: {
26 required: true, 26 required: true,
27 minlength: 6 27 minlength: 6
28 } 28 }
29 }, 29 },
30 messages: { 30 messages: {
31 emailAddress: { 31 emailAddress: {
32 required: "Please enter your email address to sign up.", 32 required: "Please enter your email address to sign up.",
33 email: "Please enter a valid email address." 33 email: "Please enter a valid email address."
34 }, 34 },
35 password: { 35 password: {
36 required: "Please enter a password to sign up.", 36 required: "Please enter a password to sign up.",
37 minlength: "Please use at least six characters." 37 minlength: "Please use at least six characters."
38 } 38 }
39 }, 39 },
40 submitHandler: function(){ 40 submitHandler: function(){
41 // Grab the user's details. 41 // Grab the user's details.
42 user = { 42 user = {
43 email: $('[name="emailAddress"]').val(), 43 email: $('[name="emailAddress"]').val(),
44 password: $('[name="password"]').val() 44 password: $('[name="password"]').val()
45 } 45 }
46 46
47 // Create the user's account. 47 // Create the user's account.
48 Accounts.createUser({email: user.email, password: user.password}, function(error){ 48 Accounts.createUser({email: user.email, password: user.password}, function(error){
49 if(error){ 49 if(error){
50 Bert.alert(error.reason, 'danger'); 50 Bert.alert(error.reason, 'danger');
51 } else { 51 } else {
52 Bert.alert('Welcome!', 'success'); 52 Bert.alert('Welcome!', 'success');
53 } 53 }
54 }); 54 });
55 } 55 }
56 }); 56 });
57 } 57 });
58 58
59 /* 59 /*
60 * Helpers 60 * Helpers
61 */ 61 */
62 62
63 Template.signup.helpers({ 63 Template.signup.helpers({
64 example: function(){ 64 example: function(){
65 // Code to run for helper function. 65 // Code to run for helper function.
66 } 66 }
67 }); 67 });
68 68
69 /* 69 /*
70 * Events 70 * Events
71 */ 71 */
72 72
73 Template.signup.events({ 73 Template.signup.events({
74 'submit form': function(e){ 74 'submit form': function(e){
75 // Prevent form from submitting. 75 // Prevent form from submitting.
76 e.preventDefault(); 76 e.preventDefault();
77 } 77 }
78 }); 78 });
79 79