зеркало из https://github.com/mozilla/fxa.git
fix(pairing): Remove the signin link when pairing fails
This commit is contained in:
Родитель
7af8c8270f
Коммит
cf5934912c
|
@ -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 couldn’t 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 couldn’t 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 })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче