mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
commit
949252f5ed
@ -16,6 +16,7 @@ var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControll
|
||||
var self = this;
|
||||
|
||||
this.validate({ format: false }).then(function () {
|
||||
self.notifications.closePassive();
|
||||
self.send('authenticate');
|
||||
}).catch(function (errors) {
|
||||
self.notifications.closePassive();
|
||||
|
@ -24,6 +24,34 @@ var ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shor
|
||||
this.send('loadServerNotifications', true);
|
||||
},
|
||||
|
||||
sessionAuthenticationFailed: function (error) {
|
||||
this.notifications.closePassive();
|
||||
this.notifications.showError(error.message);
|
||||
},
|
||||
|
||||
sessionAuthenticationSucceeded: function () {
|
||||
var self = this;
|
||||
this.store.find('user', 'me').then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
var attemptedTransition = self.get('session').get('attemptedTransition');
|
||||
if (attemptedTransition) {
|
||||
attemptedTransition.retry();
|
||||
self.get('session').set('attemptedTransition', null);
|
||||
} else {
|
||||
self.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
sessionInvalidationFailed: function (error) {
|
||||
this.notifications.closePassive();
|
||||
this.notifications.showError(error.message);
|
||||
},
|
||||
|
||||
sessionInvalidationSucceeded: function () {
|
||||
this.notifications.showSuccess('You were successfully signed out.', true);
|
||||
},
|
||||
|
||||
openModal: function (modalName, model, type) {
|
||||
modalName = 'modals/' + modalName;
|
||||
// We don't always require a modal to have a controller
|
||||
|
@ -13,40 +13,10 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, {
|
||||
deactivate: function () {
|
||||
this._super();
|
||||
|
||||
// clear the password property from the controller when we're no longer
|
||||
// on the signin screen
|
||||
this.controllerFor('signin').set('password', '');
|
||||
},
|
||||
|
||||
actions: {
|
||||
sessionAuthenticationFailed: function (error) {
|
||||
this.notifications.closePassive();
|
||||
this.notifications.showError(error.message);
|
||||
},
|
||||
sessionAuthenticationSucceeded: function () {
|
||||
var self = this;
|
||||
this.store.find('user', 'me').then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
var attemptedTransition = self.get('session').get('attemptedTransition');
|
||||
if (attemptedTransition) {
|
||||
attemptedTransition.retry();
|
||||
self.get('session').set('attemptedTransition', null);
|
||||
} else {
|
||||
self.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication);
|
||||
}
|
||||
});
|
||||
},
|
||||
sessionInvalidationFailed: function (error) {
|
||||
this.notifications.closePassive();
|
||||
this.notifications.showError(error.message);
|
||||
},
|
||||
sessionInvalidationSucceeded: function () {
|
||||
this.notifications.showSuccess('You were successfully signed out.', true);
|
||||
this.send('signedOut');
|
||||
}
|
||||
// clear the properties that hold the credentials from the controller
|
||||
// when we're no longer on the signin screen
|
||||
this.controllerFor('signin').setProperties({ identification: '', password: '' });
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
export default SigninRoute;
|
||||
|
@ -4,13 +4,14 @@ import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||
var SignoutRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, styleBody, loadingIndicator, {
|
||||
classNames: ['ghost-signout'],
|
||||
|
||||
afterModel: function (resolvedModel, transition) {
|
||||
afterModel: function (model, transition) {
|
||||
if (Ember.canInvoke(transition, 'send')) {
|
||||
transition.send('invalidateSession');
|
||||
transition.abort();
|
||||
this.transitionTo('signin');
|
||||
} else {
|
||||
this.send('invalidateSession');
|
||||
this.transitionTo('signin');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -24,7 +24,7 @@
|
||||
<li class="divider"></li>
|
||||
<li class="usermenu-help"><a href="http://support.ghost.org/">Help / Support</a></li>
|
||||
<li class="divider"></li>
|
||||
<li class="usermenu-signout"><button {{action 'invalidateSession'}}>Sign Out</button></li>
|
||||
<li class="usermenu-signout">{{#link-to "signout"}}Sign Out{{/link-to}}</li>
|
||||
{{/gh-popover}}
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user