Merge pull request #17615 from mozilla/fxa-10395

fix(pairing): Remove the signin link when pairing fails
This commit is contained in:
Vijay Budhram 2024-09-18 13:14:23 -04:00 коммит произвёл GitHub
Родитель 7d87e3cc02 cf5934912c
Коммит a43a9ca37b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 3 добавлений и 39 удалений

Просмотреть файл

@ -29,10 +29,7 @@ class SupplicantState extends State {
}
socketError(error) {
this.navigate('pair/failure', {
error,
searchParams: window.location.search,
});
this.navigate('pair/failure', { error });
}
}

Просмотреть файл

@ -12,13 +12,7 @@
</h1>
</header>
<p class="mt-3">{{#t}}The setup couldnt be completed.{{/t}}{{#showSigninLink}} {{#t}}Please sign in with your email.{{/t}}{{/showSigninLink}}</p>
{{#showSigninLink}}
<div class="button-row">
<button class="button primary-button mt-5" id="signin-button" type="button">{{#t}}Sign in{{/t}}</button>
</div>
{{/showSigninLink}}
<p class="mt-3">{{#t}}The setup couldnt be completed. Please sign in with your email.{{/t}}</p>
</form>
</section>

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 })
);
});
});