parent
							
								
									002bfa6d81
								
							
						
					
					
						commit
						135d7a2c2c
					
				
					 2 changed files with 22 additions and 16 deletions
				
			
		| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
import Ember from 'ember';
 | 
					import Ember from 'ember';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default Ember.Controller.extend({
 | 
					export default Ember.Controller.extend({
 | 
				
			||||||
 | 
					  loading: false,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  actions: {
 | 
					  actions: {
 | 
				
			||||||
    authenticate: function() {
 | 
					    authenticate: function() {
 | 
				
			||||||
      let credentials = this.getProperties('identification', 'password');
 | 
					      let credentials = this.getProperties('identification', 'password');
 | 
				
			||||||
| 
						 | 
					@ -9,12 +11,12 @@ export default Ember.Controller.extend({
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Manually clean up because there might not be a transition
 | 
					      // Manually clean up because there might not be a transition
 | 
				
			||||||
      this.get('flashMessages').clearMessages();
 | 
					      this.get('flashMessages').clearMessages();
 | 
				
			||||||
      this.transitionToRoute('loading').then(() => {
 | 
					      this.set('loading', true).then(session.authenticate(authenticator, credentials).catch((error) => {
 | 
				
			||||||
        session.authenticate(authenticator, credentials).then(null, (error)=> {
 | 
					 | 
				
			||||||
        this.transitionToRoute('login');
 | 
					        this.transitionToRoute('login');
 | 
				
			||||||
 | 
					        this.set('loading', false);
 | 
				
			||||||
        this.get('flashMessages').error(error.error);
 | 
					        this.get('flashMessages').error(error.error);
 | 
				
			||||||
        });
 | 
					      }));
 | 
				
			||||||
      });
 | 
					      this.set('loading', false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
{{#x-application invalidateSession="invalidateSession"}}
 | 
					{{#x-application invalidateSession="invalidateSession"}}
 | 
				
			||||||
 | 
					  {{#if loading}}
 | 
				
			||||||
 | 
					    {{loading-panel}}
 | 
				
			||||||
 | 
					  {{else}}
 | 
				
			||||||
    <form {{action "authenticate" on="submit"}}>
 | 
					    <form {{action "authenticate" on="submit"}}>
 | 
				
			||||||
      <h2>Log In</h2>
 | 
					      <h2>Log In</h2>
 | 
				
			||||||
        {{input value=identification type="text" placeholder="Email"}}
 | 
					        {{input value=identification type="text" placeholder="Email"}}
 | 
				
			||||||
| 
						 | 
					@ -9,4 +12,5 @@
 | 
				
			||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
      Forget your password? {{link-to 'Request a lockout email.' 'users.requestlockouthelp'}}
 | 
					      Forget your password? {{link-to 'Request a lockout email.' 'users.requestlockouthelp'}}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					  {{/if}}
 | 
				
			||||||
{{/x-application}}
 | 
					{{/x-application}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue