Link flow: Show 'you must upgrade' on 409 server response
This commit is contained in:
parent
97b657da6d
commit
d13c3d3350
5 changed files with 85 additions and 53 deletions
|
@ -1076,6 +1076,15 @@
|
||||||
"installTooManyDevices": {
|
"installTooManyDevices": {
|
||||||
"message": "Sorry, you have too many devices linked already. Try removing some."
|
"message": "Sorry, you have too many devices linked already. Try removing some."
|
||||||
},
|
},
|
||||||
|
"installTooOld": {
|
||||||
|
"message": "Update Signal on this device to link your phone."
|
||||||
|
},
|
||||||
|
"installErrorHeader": {
|
||||||
|
"message": "Something went wrong!"
|
||||||
|
},
|
||||||
|
"installTryAgain": {
|
||||||
|
"message": "Try again"
|
||||||
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"message": "Theme",
|
"message": "Theme",
|
||||||
"description": "Header for theme settings"
|
"description": "Header for theme settings"
|
||||||
|
|
|
@ -306,6 +306,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class='nav'>
|
<div class='nav'>
|
||||||
<a class='button try-again'>{{ errorButton }}</a>
|
<a class='button try-again'>{{ errorButton }}</a>
|
||||||
|
{{#errorSecondButton}}
|
||||||
|
<a class='button second'>{{ errorSecondButton }}</a>
|
||||||
|
{{/errorSecondButton}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,12 +20,14 @@
|
||||||
const DEVICE_NAME_SELECTOR = 'input.device-name';
|
const DEVICE_NAME_SELECTOR = 'input.device-name';
|
||||||
const CONNECTION_ERROR = -1;
|
const CONNECTION_ERROR = -1;
|
||||||
const TOO_MANY_DEVICES = 411;
|
const TOO_MANY_DEVICES = 411;
|
||||||
|
const TOO_OLD = 409;
|
||||||
|
|
||||||
Whisper.InstallView = Whisper.View.extend({
|
Whisper.InstallView = Whisper.View.extend({
|
||||||
templateName: 'link-flow-template',
|
templateName: 'link-flow-template',
|
||||||
className: 'main full-screen-flow',
|
className: 'main full-screen-flow',
|
||||||
events: {
|
events: {
|
||||||
'click .try-again': 'connect',
|
'click .try-again': 'connect',
|
||||||
|
'click .second': 'shutdown',
|
||||||
'click .finish': 'finishLinking',
|
'click .finish': 'finishLinking',
|
||||||
// the actual next step happens in confirmNumber() on submit form #link-phone
|
// the actual next step happens in confirmNumber() on submit form #link-phone
|
||||||
},
|
},
|
||||||
|
@ -43,6 +45,8 @@
|
||||||
},
|
},
|
||||||
render_attributes() {
|
render_attributes() {
|
||||||
let errorMessage;
|
let errorMessage;
|
||||||
|
let errorButton = i18n('installTryAgain');
|
||||||
|
let errorSecondButton = null;
|
||||||
|
|
||||||
if (this.error) {
|
if (this.error) {
|
||||||
if (
|
if (
|
||||||
|
@ -50,6 +54,13 @@
|
||||||
this.error.code === TOO_MANY_DEVICES
|
this.error.code === TOO_MANY_DEVICES
|
||||||
) {
|
) {
|
||||||
errorMessage = i18n('installTooManyDevices');
|
errorMessage = i18n('installTooManyDevices');
|
||||||
|
} else if (
|
||||||
|
this.error.name === 'HTTPError' &&
|
||||||
|
this.error.code === TOO_OLD
|
||||||
|
) {
|
||||||
|
errorMessage = i18n('installTooOld');
|
||||||
|
errorButton = i18n('upgrade');
|
||||||
|
errorSecondButton = i18n('quit');
|
||||||
} else if (
|
} else if (
|
||||||
this.error.name === 'HTTPError' &&
|
this.error.name === 'HTTPError' &&
|
||||||
this.error.code === CONNECTION_ERROR
|
this.error.code === CONNECTION_ERROR
|
||||||
|
@ -63,9 +74,10 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
errorHeader: 'Something went wrong!',
|
errorHeader: i18n('installErrorHeader'),
|
||||||
errorMessage,
|
errorMessage,
|
||||||
errorButton: 'Try again',
|
errorButton,
|
||||||
|
errorSecondButton,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +101,19 @@
|
||||||
this.step = step;
|
this.step = step;
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
shutdown() {
|
||||||
|
window.shutdown();
|
||||||
|
},
|
||||||
connect() {
|
connect() {
|
||||||
|
if (
|
||||||
|
this.error &&
|
||||||
|
this.error.name === 'HTTPError' &&
|
||||||
|
this.error.code === TOO_OLD
|
||||||
|
) {
|
||||||
|
window.location = 'https://signal.org/download';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.selectStep(Steps.SCAN_QR_CODE);
|
this.selectStep(Steps.SCAN_QR_CODE);
|
||||||
this.clearQR();
|
this.clearQR();
|
||||||
|
|
|
@ -917,9 +917,13 @@ export function initialize({
|
||||||
) {
|
) {
|
||||||
const { accessKey } = options;
|
const { accessKey } = options;
|
||||||
const jsonData: any = {
|
const jsonData: any = {
|
||||||
supportsSms: false,
|
capabilities: {
|
||||||
|
uuid: true,
|
||||||
|
},
|
||||||
fetchesMessages: true,
|
fetchesMessages: true,
|
||||||
|
name: deviceName ? deviceName : undefined,
|
||||||
registrationId,
|
registrationId,
|
||||||
|
supportsSms: false,
|
||||||
unidentifiedAccessKey: accessKey
|
unidentifiedAccessKey: accessKey
|
||||||
? _btoa(_getString(accessKey))
|
? _btoa(_getString(accessKey))
|
||||||
: undefined,
|
: undefined,
|
||||||
|
@ -929,14 +933,6 @@ export function initialize({
|
||||||
const call = deviceName ? 'devices' : 'accounts';
|
const call = deviceName ? 'devices' : 'accounts';
|
||||||
const urlPrefix = deviceName ? '/' : '/code/';
|
const urlPrefix = deviceName ? '/' : '/code/';
|
||||||
|
|
||||||
if (deviceName) {
|
|
||||||
jsonData.name = deviceName;
|
|
||||||
} else {
|
|
||||||
jsonData.capabilities = {
|
|
||||||
uuid: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// We update our saved username and password, since we're creating a new account
|
// We update our saved username and password, since we're creating a new account
|
||||||
username = number;
|
username = number;
|
||||||
password = newPassword;
|
password = newPassword;
|
||||||
|
|
|
@ -586,7 +586,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$('#qr img').remove();",
|
"line": " this.$('#qr img').remove();",
|
||||||
"lineNumber": 136,
|
"lineNumber": 160,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-09-19T21:59:32.770Z",
|
"updated": "2018-09-19T21:59:32.770Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -595,7 +595,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$('#qr .container').show();",
|
"line": " this.$('#qr .container').show();",
|
||||||
"lineNumber": 138,
|
"lineNumber": 162,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-09-19T21:59:32.770Z",
|
"updated": "2018-09-19T21:59:32.770Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -604,7 +604,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " if ($('#qr').length === 0) {",
|
"line": " if ($('#qr').length === 0) {",
|
||||||
"lineNumber": 142,
|
"lineNumber": 166,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-09-19T21:59:32.770Z",
|
"updated": "2018-09-19T21:59:32.770Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -613,7 +613,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$('#qr .container').hide();",
|
"line": " this.$('#qr .container').hide();",
|
||||||
"lineNumber": 148,
|
"lineNumber": 172,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -622,7 +622,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);",
|
"line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);",
|
||||||
"lineNumber": 149,
|
"lineNumber": 173,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -631,52 +631,52 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$('#qr').addClass('ready');",
|
"line": " this.$('#qr').addClass('ready');",
|
||||||
"lineNumber": 151,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "js/views/install_view.js",
|
|
||||||
"line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());",
|
|
||||||
"lineNumber": 156,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "js/views/install_view.js",
|
|
||||||
"line": " this.$('#link-phone').submit();",
|
|
||||||
"lineNumber": 161,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "js/views/install_view.js",
|
|
||||||
"line": " this.$('#link-phone').submit(e => {",
|
|
||||||
"lineNumber": 171,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "js/views/install_view.js",
|
|
||||||
"line": " let name = this.$(DEVICE_NAME_SELECTOR).val();",
|
|
||||||
"lineNumber": 175,
|
"lineNumber": 175,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "js/views/install_view.js",
|
||||||
|
"line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());",
|
||||||
|
"lineNumber": 180,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "js/views/install_view.js",
|
||||||
|
"line": " this.$('#link-phone').submit();",
|
||||||
|
"lineNumber": 185,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "js/views/install_view.js",
|
||||||
|
"line": " this.$('#link-phone').submit(e => {",
|
||||||
|
"lineNumber": 195,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "js/views/install_view.js",
|
||||||
|
"line": " let name = this.$(DEVICE_NAME_SELECTOR).val();",
|
||||||
|
"lineNumber": 199,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$(DEVICE_NAME_SELECTOR).focus();",
|
"line": " this.$(DEVICE_NAME_SELECTOR).focus();",
|
||||||
"lineNumber": 178,
|
"lineNumber": 202,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue