mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
allow re-login when authorization fails on editor.edit route
This commit is contained in:
parent
7946926c93
commit
569c185de7
12
ghost/admin/controllers/modals/signin.js
Normal file
12
ghost/admin/controllers/modals/signin.js
Normal file
@ -0,0 +1,12 @@
|
||||
import SigninController from '../signin';
|
||||
|
||||
export default SigninController.extend({
|
||||
actions: {
|
||||
authenticate: function (data) {
|
||||
var self = this;
|
||||
this._super(data).then(function () {
|
||||
self.send('closeModal');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -27,9 +27,9 @@ AuthenticationInitializer = {
|
||||
};
|
||||
|
||||
SimpleAuth.Session.reopen({
|
||||
user: Ember.computed(function () {
|
||||
user: function () {
|
||||
return container.lookup('store:main').find('user', 'me');
|
||||
})
|
||||
}).property()
|
||||
});
|
||||
|
||||
SimpleAuth.Authenticators.OAuth2.reopen({
|
||||
|
@ -23,22 +23,6 @@ ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shortcut
|
||||
},
|
||||
|
||||
actions: {
|
||||
authorizationFailed: function () {
|
||||
var currentRoute = this.get('controller').get('currentRouteName'),
|
||||
editorController;
|
||||
|
||||
if (currentRoute.split('.')[0] === 'editor') {
|
||||
editorController = this.controllerFor(currentRoute);
|
||||
|
||||
if (editorController.get('isDirty')) {
|
||||
this.send('openModal', 'auth-failed-unsaved', editorController);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._super();
|
||||
},
|
||||
|
||||
toggleGlobalMobileNav: function () {
|
||||
this.toggleProperty('controller.showGlobalMobileNav');
|
||||
},
|
||||
@ -46,9 +30,11 @@ ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shortcut
|
||||
openSettingsMenu: function () {
|
||||
this.set('controller.showSettingsMenu', true);
|
||||
},
|
||||
|
||||
closeSettingsMenu: function () {
|
||||
this.set('controller.showSettingsMenu', false);
|
||||
},
|
||||
|
||||
toggleSettingsMenu: function () {
|
||||
this.toggleProperty('controller.showSettingsMenu');
|
||||
},
|
||||
|
@ -48,6 +48,12 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, {
|
||||
return self.replaceWith('posts.index');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
authorizationFailed: function () {
|
||||
this.send('openModal', 'signin');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
14
ghost/admin/templates/modals/signin.hbs
Normal file
14
ghost/admin/templates/modals/signin.hbs
Normal file
@ -0,0 +1,14 @@
|
||||
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade"
|
||||
title="Please login again" confirm=confirm}}
|
||||
|
||||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'validateAndAuthenticate' on='submit'}}>
|
||||
<div class="email-wrap">
|
||||
{{input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus" autocapitalize="off" autocorrect="off" value=identification}}
|
||||
</div>
|
||||
<div class="password-wrap">
|
||||
{{input class="password" type="password" placeholder="Password" name="password" value=password}}
|
||||
</div>
|
||||
<button class="button-save" type="submit" {{action "validateAndAuthenticate"}} {{bind-attr disabled=submitting}}>Log in</button>
|
||||
</form>
|
||||
|
||||
{{/gh-modal-dialog}}
|
@ -2,8 +2,7 @@
|
||||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'validateAndAuthenticate' on='submit'}}>
|
||||
<div class="email-wrap">
|
||||
<span class="input-icon icon-mail">
|
||||
{{gh-trim-focus-input class="email" type="email" placeholder="Email Address" name="identification"
|
||||
autocapitalize="off" autocorrect="off" value=identification}}
|
||||
{{gh-trim-focus-input class="email" type="email" placeholder="Email Address" name="identification" autocapitalize="off" autocorrect="off" value=identification}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="password-wrap">
|
||||
|
Loading…
Reference in New Issue
Block a user