From fec5587b87889e4eac6309df6210843ad0200149 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 24 Dec 2022 17:38:34 -0700 Subject: [PATCH] ui/authenticationview: fix token pasting ... ... on certain platforms where current context does not include Clipboard API in the navigator namespace --- ui/src/views/AuthenticationView.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/src/views/AuthenticationView.vue b/ui/src/views/AuthenticationView.vue index d648249..5ea42a0 100644 --- a/ui/src/views/AuthenticationView.vue +++ b/ui/src/views/AuthenticationView.vue @@ -134,9 +134,14 @@ export default { paste: function () { window.document.getElementById('token').focus() const that = this - window.navigator.clipboard.readText().then(function (v) { - that.combined_token = v.trim() - }).catch(function () {}) + if ('readText' in (window.navigator.clipboard ?? {})) { + window.navigator.clipboard.readText().then(function (v) { + that.combined_token = v.trim() + }).catch(() => {}) + } else { + this.combined_token = '' + document.execCommand('paste') + } }, launch_browser: function (url) { const that = this