diff --git a/core/client/controllers/modals/signin.js b/core/client/controllers/modals/signin.js new file mode 100644 index 0000000000..bcbb24579f --- /dev/null +++ b/core/client/controllers/modals/signin.js @@ -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'); + }); + } + } +}); diff --git a/core/client/initializers/authentication.js b/core/client/initializers/authentication.js index 9861cb4e5c..7bb49c2698 100644 --- a/core/client/initializers/authentication.js +++ b/core/client/initializers/authentication.js @@ -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({ diff --git a/core/client/routes/application.js b/core/client/routes/application.js index efae553d1b..c6aadc7182 100644 --- a/core/client/routes/application.js +++ b/core/client/routes/application.js @@ -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'); }, diff --git a/core/client/routes/editor/edit.js b/core/client/routes/editor/edit.js index 094040a7f0..d067bd37e2 100644 --- a/core/client/routes/editor/edit.js +++ b/core/client/routes/editor/edit.js @@ -48,6 +48,12 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, { return self.replaceWith('posts.index'); } }); + }, + + actions: { + authorizationFailed: function () { + this.send('openModal', 'signin'); + } } }); diff --git a/core/client/templates/modals/signin.hbs b/core/client/templates/modals/signin.hbs new file mode 100644 index 0000000000..2006f8d40b --- /dev/null +++ b/core/client/templates/modals/signin.hbs @@ -0,0 +1,14 @@ +{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade" + title="Please login again" confirm=confirm}} + +
+
+ {{input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus" autocapitalize="off" autocorrect="off" value=identification}} +
+
+ {{input class="password" type="password" placeholder="Password" name="password" value=password}} +
+ +
+ +{{/gh-modal-dialog}} diff --git a/core/client/templates/signin.hbs b/core/client/templates/signin.hbs index f225774759..27e2d54e1f 100644 --- a/core/client/templates/signin.hbs +++ b/core/client/templates/signin.hbs @@ -2,8 +2,7 @@
- {{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}}