From b7c14b7a09630a9448129116a0909a0feae5eff9 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Fri, 6 Mar 2015 12:32:45 +0700 Subject: [PATCH] Allow submitting token input with empty value to remove token. --- public/lib/loadSwaggerUI.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/lib/loadSwaggerUI.js b/public/lib/loadSwaggerUI.js index 327a126..8cea670 100644 --- a/public/lib/loadSwaggerUI.js +++ b/public/lib/loadSwaggerUI.js @@ -64,6 +64,17 @@ $(function() { window.localStorage.setItem(lsKey, key); } } + // If submitted with an empty token, remove the current token. Can be + // useful to intentionally remove authorization. + else { + log('removed accessToken.'); + $('.accessTokenDisplay').text('Token Not Set.').removeClass('set'); + $('.accessTokenDisplay').removeAttr('data-tooltip'); + window.authorizations.remove('key'); + if (window.localStorage) { + window.localStorage.removeItem(lsKey); + } + } } function onInputChange(e) {