diff --git a/app/pods/users/new/new-user-form/component.js b/app/pods/users/new/new-user-form/component.js
index a0060a5..dd41ea0 100644
--- a/app/pods/users/new/new-user-form/component.js
+++ b/app/pods/users/new/new-user-form/component.js
@@ -6,7 +6,14 @@ export default Ember.Component.extend({
actions: {
save: function() {
- var user = this.get('user');
+ let user = this.get('user');
+
+ // All validation is server-side, except for password verification matching
+ if (user.get('password') !== this.get('passwordConfirm')) {
+ this.get('flashMessages').clearMessages();
+ this.get('flashMessages').error("Password fields don't match");
+ return;
+ }
if (user.get('isDirty')) {
user.save().then(() => {
diff --git a/app/pods/users/new/new-user-form/template.hbs b/app/pods/users/new/new-user-form/template.hbs
index d4d2958..da73395 100644
--- a/app/pods/users/new/new-user-form/template.hbs
+++ b/app/pods/users/new/new-user-form/template.hbs
@@ -13,11 +13,11 @@
- {{input value=user.password}}
+ {{input type="password" value=user.password}}
- {{input value=passwordConfirm}}
+ {{input type="password" value=passwordConfirm}}
diff --git a/app/pods/users/new/route.js b/app/pods/users/new/route.js
index 7d5b4a3..5557316 100644
--- a/app/pods/users/new/route.js
+++ b/app/pods/users/new/route.js
@@ -14,9 +14,10 @@ export default Ember.Route.extend(UnauthenticatedRouteMixin, {
actions: {
success: function() {
- this.transitionTo('login');
- this.get('flashMessages').information(`You have successfully signed up.
- Please check your email for further instructions.`);
+ this.transitionTo('login').then(() => {
+ this.get('flashMessages').information(`You have successfully signed up.
+ Please check your email for further instructions.`);
+ });
}
},
});
diff --git a/server/mocks/users.js b/server/mocks/users.js
index 428b3e9..1e3183c 100644
--- a/server/mocks/users.js
+++ b/server/mocks/users.js
@@ -47,16 +47,16 @@ module.exports = function(app) {
});
usersRouter.post('/', function(req, res) {
- // req.body.user.id = Math.max.apply(Math, USERS.map(function(o){return o.id;})) + 1;
- // res.status(201).send(req.body);
- // NOTE - use the following for testing errors
- res.status(422).send({
- 'errors':{
- "name": ["Must provide a value"],
- "email": ["Must provide a value"],
- "password": ["Must provide a value"],
- }
- }).end();
+ req.body.user.id = Math.max.apply(Math, USERS.map(function(o){return o.id;})) + 1;
+ res.status(201).send(req.body);
+ // // NOTE - use the following for testing errors
+ // res.status(422).send({
+ // 'errors':{
+ // "name": ["Must provide a value"],
+ // "email": ["Must provide a value"],
+ // "password": ["Must provide a value"],
+ // }
+ // }).end();
});
usersRouter.get('/:id', function(req, res) {