New user double check password + aesthetics
This commit is contained in:
		
							parent
							
								
									f95b6e4c5f
								
							
						
					
					
						commit
						a5f98bbe23
					
				
					 4 changed files with 24 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -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(() => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,11 +13,11 @@
 | 
			
		|||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Password</label>
 | 
			
		||||
          {{input value=user.password}}
 | 
			
		||||
          {{input type="password" value=user.password}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Password (confirm)</label>
 | 
			
		||||
          {{input value=passwordConfirm}}
 | 
			
		||||
          {{input type="password" value=passwordConfirm}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <a class="button-green smaller" {{action 'save'}}>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,9 +14,10 @@ export default Ember.Route.extend(UnauthenticatedRouteMixin, {
 | 
			
		|||
 | 
			
		||||
  actions: {
 | 
			
		||||
    success: function() {
 | 
			
		||||
      this.transitionTo('login');
 | 
			
		||||
      this.transitionTo('login').then(() => {
 | 
			
		||||
        this.get('flashMessages').information(`You have successfully signed up.
 | 
			
		||||
          Please check your email for further instructions.`);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue