Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(client): Only send a link_expired event if the password reset l…
Browse files Browse the repository at this point in the history
…ink is expired.

fixes #1283
  • Loading branch information
Shane Tomlinson committed Jun 24, 2014
1 parent d71f51f commit 3831041
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/scripts/views/complete_reset_password.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function (_, BaseView, FormView, Template, Session, PasswordMixin, FloatingPlace
return this.fxaClient.isPasswordResetComplete(this.token)
.then(function (isComplete) {
self._isLinkExpired = isComplete;
self.logEvent('complete_reset_password:link_expired');
if (isComplete) {
self.logEvent('complete_reset_password:link_expired');
}
return true;
});
},
Expand Down
10 changes: 9 additions & 1 deletion app/tests/spec/views/complete_reset_password.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function (chai, p, AuthErrors, Metrics, View, RouterMock, WindowMock, TestHelper
assert.isTrue(TestHelpers.isEventLogged(metrics, eventName));
}

function testEventNotLogged(eventName) {
assert.isFalse(TestHelpers.isEventLogged(metrics, eventName));
}

beforeEach(function () {
routerMock = new RouterMock();
windowMock = new WindowMock();
Expand Down Expand Up @@ -62,7 +66,11 @@ function (chai, p, AuthErrors, Metrics, View, RouterMock, WindowMock, TestHelper

describe('render', function () {
it('shows form if token, code and email are all present', function () {
assert.ok(view.$('#fxa-complete-reset-password-header').length);
return view.render()
.then(function () {
testEventNotLogged('complete_reset_password:link_expired');
assert.ok(view.$('#fxa-complete-reset-password-header').length);
});
});

it('shows malformed screen if the token is missing', function () {
Expand Down

0 comments on commit 3831041

Please sign in to comment.