From cf5934912ce03025c4567e521440fbe00f30102d Mon Sep 17 00:00:00 2001 From: Vijay Budhram Date: Mon, 16 Sep 2024 13:38:26 -0400 Subject: [PATCH] fix(pairing): Remove the signin link when pairing fails --- .../pairing/supplicant-state-machine.js | 5 +--- .../scripts/templates/pair/failure.mustache | 8 +------ .../app/scripts/views/pair/failure.js | 24 ------------------- .../pairing/supplicant-state-machine.js | 5 +--- 4 files changed, 3 insertions(+), 39 deletions(-) diff --git a/packages/fxa-content-server/app/scripts/models/pairing/supplicant-state-machine.js b/packages/fxa-content-server/app/scripts/models/pairing/supplicant-state-machine.js index 2bfec46129..fe4a91b094 100644 --- a/packages/fxa-content-server/app/scripts/models/pairing/supplicant-state-machine.js +++ b/packages/fxa-content-server/app/scripts/models/pairing/supplicant-state-machine.js @@ -29,10 +29,7 @@ class SupplicantState extends State { } socketError(error) { - this.navigate('pair/failure', { - error, - searchParams: window.location.search, - }); + this.navigate('pair/failure', { error }); } } diff --git a/packages/fxa-content-server/app/scripts/templates/pair/failure.mustache b/packages/fxa-content-server/app/scripts/templates/pair/failure.mustache index 480363db4f..eab518d65c 100644 --- a/packages/fxa-content-server/app/scripts/templates/pair/failure.mustache +++ b/packages/fxa-content-server/app/scripts/templates/pair/failure.mustache @@ -12,13 +12,7 @@ -

{{#t}}The setup couldn’t be completed.{{/t}}{{#showSigninLink}} {{#t}}Please sign in with your email.{{/t}}{{/showSigninLink}}

- - {{#showSigninLink}} -
- -
- {{/showSigninLink}} +

{{#t}}The setup couldn’t be completed. Please sign in with your email.{{/t}}

diff --git a/packages/fxa-content-server/app/scripts/views/pair/failure.js b/packages/fxa-content-server/app/scripts/views/pair/failure.js index b02554ce15..8c109453b1 100644 --- a/packages/fxa-content-server/app/scripts/views/pair/failure.js +++ b/packages/fxa-content-server/app/scripts/views/pair/failure.js @@ -4,33 +4,9 @@ import FormView from '../form'; import Template from '../../templates/pair/failure.mustache'; -import { assign } from 'underscore'; -import preventDefaultThen from '../decorators/prevent_default_then'; class PairFailureView extends FormView { template = Template; - - events = assign(this.events, { - 'click #signin-button': preventDefaultThen('clickSignin'), - }); - - setInitialContext(context) { - const showSigninLink = !!this.model.get('searchParams'); - context.set({ - showSigninLink, - }); - } - - clickSignin() { - const params = this.model.get('searchParams'); - - // We replace the `email` with `prefillEmail` so that the email - // first page gets populated correctly. - const email = params.get('email'); - params.delete('email'); - params.set('prefillEmail', email); - window.location.href = `${window.location.origin}${params}`; - } } export default PairFailureView; diff --git a/packages/fxa-content-server/app/tests/spec/models/pairing/supplicant-state-machine.js b/packages/fxa-content-server/app/tests/spec/models/pairing/supplicant-state-machine.js index a6ff8fd83f..7cdcf3f767 100644 --- a/packages/fxa-content-server/app/tests/spec/models/pairing/supplicant-state-machine.js +++ b/packages/fxa-content-server/app/tests/spec/models/pairing/supplicant-state-machine.js @@ -84,10 +84,7 @@ describe('models/auth_brokers/pairing/supplicant-state-machine', function () { const err = new Error('socker error;'); state.socketError(err); assert.isTrue( - state.navigate.calledOnceWith('pair/failure', { - error: err, - searchParams: '', - }) + state.navigate.calledOnceWith('pair/failure', { error: err }) ); }); });