ui/authenticationview: fix token pasting ...

... on certain platforms where current context does not include
Clipboard API in the navigator namespace
This commit is contained in:
liushuyu 2022-12-24 17:38:34 -07:00
parent d28b19c25a
commit fec5587b87
No known key found for this signature in database
GPG key ID: 23D1CE4534419437

View file

@ -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