diff --git a/ghost/admin/router.js b/ghost/admin/router.js index 8451dde349..9d29917672 100644 --- a/ghost/admin/router.js +++ b/ghost/admin/router.js @@ -14,7 +14,8 @@ 'debug/' : 'debug', 'register/' : 'register', 'signup/' : 'signup', - 'signin/' : 'login' + 'signin/' : 'login', + 'forgotten/' : 'forgotten' }, signup: function () { @@ -25,6 +26,10 @@ Ghost.currentView = new Ghost.Views.Login({ el: '.js-login-container' }); }, + forgotten: function () { + Ghost.currentView = new Ghost.Views.Forgotten({ el: '.js-login-container' }); + }, + blog: function () { var posts = new Ghost.Collections.Posts(); posts.fetch({ data: { status: 'all', orderBy: ['updated_at', 'DESC'] } }).then(function () { diff --git a/ghost/admin/tpl/forgotten.hbs b/ghost/admin/tpl/forgotten.hbs new file mode 100644 index 0000000000..3c95df66ac --- /dev/null +++ b/ghost/admin/tpl/forgotten.hbs @@ -0,0 +1,9 @@ +
diff --git a/ghost/admin/tpl/login.hbs b/ghost/admin/tpl/login.hbs index 1cfe935c01..4bdc85d2a0 100644 --- a/ghost/admin/tpl/login.hbs +++ b/ghost/admin/tpl/login.hbs @@ -7,6 +7,6 @@ diff --git a/ghost/admin/views/login.js b/ghost/admin/views/login.js index e6b1a584e7..c3c1edce8e 100644 --- a/ghost/admin/views/login.js +++ b/ghost/admin/views/login.js @@ -109,4 +109,38 @@ }); } }); + + Ghost.Views.Forgotten = Ghost.SimpleFormView.extend({ + + templateName: "forgotten", + + events: { + 'submit #forgotten': 'submitHandler' + }, + + submitHandler: function (event) { + event.preventDefault(); + + var email = this.$el.find('.email').val(); + + $.ajax({ + url: '/ghost/forgotten/', + type: 'POST', + data: { + email: email + }, + success: function (msg) { + + window.location.href = msg.redirect; + }, + error: function (xhr) { + Ghost.notifications.addItem({ + type: 'error', + message: Ghost.Views.Utils.getRequestErrorMessage(xhr), + status: 'passive' + }); + } + }); + } + }); }());