Clean up some loading stuff

This commit is contained in:
Matthew Dillon 2015-07-17 07:32:53 -08:00
parent 1bb5dc67b2
commit fb57534b64
3 changed files with 15 additions and 18 deletions

View file

@ -7,12 +7,12 @@ export default Ember.Controller.extend({
let session = this.get('session'); let session = this.get('session');
let authenticator = 'simple-auth-authenticator:token'; let authenticator = 'simple-auth-authenticator:token';
this.set('loading', true);
// 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();
session.authenticate(authenticator, credentials).then(null, (error)=> { this.transitionTo('loading').then(() => {
this.set('loading', false); session.authenticate(authenticator, credentials).then(null, (error)=> {
this.get('flashMessages').error(error.error); this.get('flashMessages').error(error.error);
});
}); });
} }
} }

View file

@ -1,16 +1,12 @@
{{#x-application invalidateSession="invalidateSession"}} {{#x-application invalidateSession="invalidateSession"}}
{{#if loading}} <form {{action "authenticate" on="submit"}}>
{{loading-panel}} <h2>Log In</h2>
{{else}} {{input value=identification type="text" placeholder="Email"}}
<form {{action "authenticate" on="submit"}}> {{input value=password type="password" placeholder="Password"}}
<h2>Log In</h2> {{input class="button-gray" type="submit" value="Log In"}}
{{input value=identification type="text" placeholder="Email"}} </form>
{{input value=password type="password" placeholder="Password"}} <br>
{{input class="button-gray" type="submit" value="Log In"}} <div>
</form> Forget your password? {{link-to 'Request a lockout email.' 'users.requestlockouthelp'}}
<br> </div>
<div>
Forget your password? {{link-to 'Request a lockout email.' 'users.requestlockouthelp'}}
</div>
{{/if}}
{{/x-application}} {{/x-application}}

View file

@ -0,0 +1 @@
{{loading-panel}}