mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 16:23:18 +01:00
Add Copy to clipboard on OTP popup
This commit is contained in:
parent
fe916c08c0
commit
5bb4ad3823
5
package-lock.json
generated
5
package-lock.json
generated
@ -9111,6 +9111,11 @@
|
|||||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
|
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"v-clipboard": {
|
||||||
|
"version": "2.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/v-clipboard/-/v-clipboard-2.2.2.tgz",
|
||||||
|
"integrity": "sha512-8Nch/q4j4e5BqHFuKUReKBvB7lzn9FQTEuPa54pmfX44VYhWnxAoSHuMwm2Qf9EnyCSEmczqj2VYPsU2BEe6Mw=="
|
||||||
|
},
|
||||||
"v8-compile-cache": {
|
"v8-compile-cache": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"@fortawesome/free-regular-svg-icons": "^5.12.0",
|
"@fortawesome/free-regular-svg-icons": "^5.12.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.12.0",
|
"@fortawesome/free-solid-svg-icons": "^5.12.0",
|
||||||
"@fortawesome/vue-fontawesome": "^0.1.9",
|
"@fortawesome/vue-fontawesome": "^0.1.9",
|
||||||
|
"v-clipboard": "^2.2.2",
|
||||||
"vue-i18n": "^8.15.3",
|
"vue-i18n": "^8.15.3",
|
||||||
"vue-router": "^3.1.3"
|
"vue-router": "^3.1.3"
|
||||||
}
|
}
|
||||||
|
1
resources/js/app.js
vendored
1
resources/js/app.js
vendored
@ -2,6 +2,7 @@ import Vue from 'vue'
|
|||||||
import router from './routes'
|
import router from './routes'
|
||||||
import i18n from './langs/i18n'
|
import i18n from './langs/i18n'
|
||||||
import FontAwesome from './packages/fontawesome'
|
import FontAwesome from './packages/fontawesome'
|
||||||
|
import Clipboard from './packages/clipboard'
|
||||||
import App from './components/App'
|
import App from './components/App'
|
||||||
|
|
||||||
import './components'
|
import './components'
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<p id="otp" title="refresh" class="is-size-1 has-text-white">{{ totp }}</p>
|
<p id="otp" class="is-size-1 has-text-white" :title="$t('commons.copy_to_clipboard')" v-clipboard="() => totp.replace(/ /g, '')" v-clipboard:success="clipboardSuccessHandler">{{ totp }}</p>
|
||||||
<ul class="dots">
|
<ul class="dots">
|
||||||
<li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li>
|
<li v-for="n in 30"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -65,6 +66,7 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
clearOTP: function() {
|
clearOTP: function() {
|
||||||
this.stopLoop()
|
this.stopLoop()
|
||||||
this.timerID = null
|
this.timerID = null
|
||||||
@ -72,9 +74,19 @@
|
|||||||
this.$el.querySelector('[data-is-active]').removeAttribute('data-is-active');
|
this.$el.querySelector('[data-is-active]').removeAttribute('data-is-active');
|
||||||
this.$el.querySelector('.dots li:first-child').setAttribute('data-is-active', true);
|
this.$el.querySelector('.dots li:first-child').setAttribute('data-is-active', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
stopLoop: function() {
|
stopLoop: function() {
|
||||||
clearInterval(this.timerID)
|
clearInterval(this.timerID)
|
||||||
|
},
|
||||||
|
|
||||||
|
clipboardSuccessHandler ({ value, event }) {
|
||||||
|
console.log('success', value)
|
||||||
|
},
|
||||||
|
|
||||||
|
clipboardErrorHandler ({ value, event }) {
|
||||||
|
console.log('error', value)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.stopLoop()
|
this.stopLoop()
|
||||||
|
3
resources/js/langs/locales.js
vendored
3
resources/js/langs/locales.js
vendored
@ -26,7 +26,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commons": {
|
"commons": {
|
||||||
"cancel": "Cancel"
|
"cancel": "Cancel",
|
||||||
|
"copy_to_clipboard": "Copy to clipboard"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"resource_not_found": "Resource not found",
|
"resource_not_found": "Resource not found",
|
||||||
|
4
resources/js/packages/clipboard.js
vendored
Normal file
4
resources/js/packages/clipboard.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import Clipboard from 'v-clipboard'
|
||||||
|
|
||||||
|
Vue.use(Clipboard)
|
@ -14,5 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'cancel' => 'Cancel',
|
'cancel' => 'Cancel',
|
||||||
|
'copy_to_clipboard' => 'Copy to clipboard',
|
||||||
|
|
||||||
];
|
];
|
Loading…
Reference in New Issue
Block a user