| @@ -357,9 +357,13 @@ | ||
| 357 | 357 | |
| 358 | 358 | confirmSetup: function() { |
| 359 | 359 | var self = this; |
| 360 | 360 | var c = this.cfg(); |
| 361 | - var code = $('#vigilante_totp_verify_code').val().trim(); | |
| 361 | + // Separators are presentation: a password manager shows the code | |
| 362 | + // as "123 456" and pastes it that way. The server drops everything | |
| 363 | + // that is not a digit too; this is only so the length check below | |
| 364 | + // measures the code and not the spaces. | |
| 365 | + var code = $('#vigilante_totp_verify_code').val().replace(/\D/g, ''); | |
| 362 | 366 | var secret = $('.vigilante-totp-setup-qr').data('secret'); |
| 363 | 367 | var $status = $('.vigilante-totp-setup-status'); |
| 364 | 368 | var $btn = $('.vigilante-totp-confirm-setup'); |
| 365 | 369 | |
| @@ -414,9 +418,10 @@ | ||
| 414 | 418 | |
| 415 | 419 | reconfigure: function($btn) { |
| 416 | 420 | var c = this.cfg(); |
| 417 | 421 | |
| 418 | - if (!confirm(c.strings.confirmReconfig || 'This will reset your current TOTP setup. Continue?')) return; | |
| 422 | + // The button carries its own question when it removes a setup nothing asks for (2.11.11). | |
| 423 | + if (!confirm($btn.data('confirm') || c.strings.confirmReconfig || 'This will reset your current TOTP setup. Continue?')) return; | |
| 419 | 424 | |
| 420 | 425 | $btn.prop('disabled', true).text('Resetting...'); |
| 421 | 426 | |
| 422 | 427 | $.post(c.ajaxUrl, { |