|
|
|
@ -14,7 +14,8 @@
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function updateNumberColors() {
|
|
|
|
|
;(function() {
|
|
|
|
|
function updateNumberColors() {
|
|
|
|
|
try {
|
|
|
|
|
if($('#number').val() != "" && $('#regionCode').val() != "")
|
|
|
|
|
textsecure.utils.verifyNumber($('#number').val(), $('#regionCode').val());
|
|
|
|
@ -25,23 +26,23 @@ function updateNumberColors() {
|
|
|
|
|
$('#countrycode').addClass('invalid');
|
|
|
|
|
$('#number').addClass('invalid');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isCodeValid() {
|
|
|
|
|
function isCodeValid() {
|
|
|
|
|
var verificationCode = $('#code').val().replace(/\D/g, '');
|
|
|
|
|
return verificationCode.length == 6;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#code').on('change', function() {
|
|
|
|
|
$('#code').on('change', function() {
|
|
|
|
|
if (!isCodeValid())
|
|
|
|
|
$('#code').addClass('invalid');
|
|
|
|
|
else
|
|
|
|
|
$('#code').removeClass('invalid');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var single_device = false;
|
|
|
|
|
var single_device = false;
|
|
|
|
|
|
|
|
|
|
$('#init-go-single-client').click(function() {
|
|
|
|
|
$('#init-go-single-client').click(function() {
|
|
|
|
|
try {
|
|
|
|
|
var parsedNumber = textsecure.utils.verifyNumber($('#number').val(), $('#regionCode').val());
|
|
|
|
|
} catch(e) {
|
|
|
|
@ -64,9 +65,9 @@ $('#init-go-single-client').click(function() {
|
|
|
|
|
else
|
|
|
|
|
alert(error); // XXX
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#init-go').click(function() {
|
|
|
|
|
$('#init-go').click(function() {
|
|
|
|
|
var parsedNumber = textsecure.utils.verifyNumber($('#number').val(), $('#regionCode').val());
|
|
|
|
|
if (!isCodeValid()) {
|
|
|
|
|
updateCodeColor();
|
|
|
|
@ -102,9 +103,9 @@ $('#init-go').click(function() {
|
|
|
|
|
else
|
|
|
|
|
alert(error); //XXX
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
textsecure.registerOnLoadFunction(function() {
|
|
|
|
|
textsecure.registerOnLoadFunction(function() {
|
|
|
|
|
$(function() {
|
|
|
|
|
if (!isRegistrationDone()) {
|
|
|
|
|
$('#init-setup').show();
|
|
|
|
@ -192,4 +193,5 @@ textsecure.registerOnLoadFunction(function() {
|
|
|
|
|
$('#setup-complete').show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})();
|
|
|
|
|