Fix registration page

Also make it accessible by providing a mode argument to the install
function. Previously developers could just edit the url but we no longer
have the address bar as an app window, so now they must close the
default installer and run the following from the background page
console: `extension.install('standalone')`.

In the production build, this should result in an error since it is not
supported / the register page is not included there.
This commit is contained in:
lilia 2015-05-14 14:50:52 -07:00
parent 7afd0a02e8
commit 5a7ab54ee6
4 changed files with 14 additions and 11 deletions

View File

@ -41,7 +41,7 @@ Currently only the Android client supports multi-device pairing.
## Standalone Registration
**NOTE:** This is only for developers and will not be presented to users.
* Open the registration page: chrome-extension://fpnlppjheenfplekcodjceiknbfnengc/register.html
* Open the background page and run the following command in the console: `extension.install("standalone")`.
* Enter a real phone number (Google Voice numbers work too) and country
combination and choose to send an SMS. You will receive a real SMS.
* Enter the verification code you received by SMS.

View File

@ -166,10 +166,16 @@
},
};
extension.install = function() {
extension.install = function(mode) {
var id = 'installer';
var url = 'options.html';
if (mode === 'standalone') {
id = 'standalone-installer';
url = 'register.html';
}
extension.windows.open({
id: 'installer',
url: 'options.html',
id: id,
url: url,
innerBounds: { width: 800, height: 666 }
});
};

View File

@ -80,10 +80,8 @@
var accountManager = new bg.textsecure.AccountManager();
accountManager.registerSecondDevice(setProvisioningUrl, confirmNumber, incrementCounter).then(function() {
extension.windows.getCurrent(function(appWindow) {
bg.openInbox();
extension.windows.remove(appWindow.id);
});
bg.openInbox();
window.close();
});
}
});

View File

@ -85,10 +85,9 @@
var number = phoneView.validateNumber();
var verificationCode = $('#code').val().replace(/\D+/g, "");
localStorage.clear();
localStorage.setItem('first_install_ran', 1);
bg.storage.put('first_install_ran', 1);
accountManager.registerSingleDevice(number, verificationCode).then(function() {
extension.navigator.tabs.create("options.html");
bg.openInbox();
window.close();
}).catch(function(e) {
log(e);