From 5130d9e2f31d98c4a45749ed2af7b990d90a4e95 Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 6 Feb 2017 22:39:45 +0100 Subject: [PATCH] New state for "only new button" Used when the message cannot be decrypted. Fixes https://github.com/PrivateBin/PrivateBin/issues/126 --- js/privatebin.js | 36 +++++++++++++++++++++++++++++++++--- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 1e98abf..4fd0e99 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -781,9 +781,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { } catch(err) { - this.clearText.addClass('hidden'); - this.prettyMessage.addClass('hidden'); - this.cloneButton.addClass('hidden'); + this.stateOnlyNewPaste(); this.showError(i18n._('Could not decrypt data (Wrong key?)')); return; } @@ -1253,6 +1251,38 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { this.loadingIndicator.removeClass('hidden'); }, + /** + * put the screen in a state where the only option is to submit a + * new paste + * + * @name controller.stateOnlyNewPaste + * @function + */ + stateOnlyNewPaste: function() + { + this.message.text(''); + this.attachment.addClass('hidden'); + this.cloneButton.addClass('hidden'); + this.rawTextButton.addClass('hidden'); + this.remainingTime.addClass('hidden'); + this.pasteResult.addClass('hidden'); + this.clearText.addClass('hidden'); + this.discussion.addClass('hidden'); + this.prettyMessage.addClass('hidden'); + this.sendButton.addClass('hidden'); + this.expiration.addClass('hidden'); + this.formatter.addClass('hidden'); + this.burnAfterReadingOption.addClass('hidden'); + this.openDisc.addClass('hidden'); + this.password.addClass('hidden'); + this.attach.addClass('hidden'); + this.message.addClass('hidden'); + this.preview.addClass('hidden'); + this.loadingIndicator.addClass('hidden'); + + this.newButton.removeClass('hidden'); + }, + /** * put the screen in "Existing paste" mode * diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index c3dc81e..60c6727 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 6ab8f9f..c92136f 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +