diff --git a/core/client/controllers/application.js b/core/client/controllers/application.js index 8e7bf23437..437b6bd74b 100644 --- a/core/client/controllers/application.js +++ b/core/client/controllers/application.js @@ -1,5 +1,6 @@ var ApplicationController = Ember.Controller.extend({ isSignedIn: Ember.computed.bool('user.isSignedIn'), + hideNav: Ember.computed.match('currentPath', /(signin|signup|forgotten|reset)/), actions: { toggleMenu: function () { diff --git a/core/client/routes/signup.js b/core/client/routes/signup.js index 0e4f00bdcb..ffe8d2c414 100644 --- a/core/client/routes/signup.js +++ b/core/client/routes/signup.js @@ -1,7 +1,47 @@ +import ajax from 'ghost/utils/ajax'; import styleBody from 'ghost/mixins/style-body'; var SignupRoute = Ember.Route.extend(styleBody, { - classNames: ['ghost-signup'] + classNames: ['ghost-signup'], + + name: null, + email: null, + password: null, + + actions: { + signup: function () { + var self = this, + controller = this.get('controller'), + data = controller.getProperties('name', 'email', 'password'); + + // TODO: Validate data + + if (data.name && data.email && data.password) { + ajax({ + url: '/ghost/signup/', + type: 'POST', + headers: { + 'X-CSRF-Token': this.get('csrf') + }, + data: data + }).then(function (resp) { + if (resp && resp.userData) { + self.send('signedIn', resp.userData); + + self.notifications.clear(); + + self.transitionTo('posts'); + } else { + self.transitionTo('signin'); + } + }, function (resp) { + self.notifications.showAPIError(resp); + }); + } else { + this.notifications.showError('Must provide name, email and password'); + } + } + } }); export default SignupRoute; diff --git a/core/client/templates/-navbar.hbs b/core/client/templates/-navbar.hbs index cca89761ef..7a8a746600 100644 --- a/core/client/templates/-navbar.hbs +++ b/core/client/templates/-navbar.hbs @@ -10,7 +10,11 @@