Check copy state before notifying

This commit is contained in:
Bubka 2023-10-20 13:24:55 +02:00
parent 68d98652a3
commit 4055a52daf

View File

@ -9,7 +9,7 @@
const user = useUserStore()
const $2fauth = inject('2fauth')
const { copy } = useClipboard({ legacy: true })
const { copy, copied } = useClipboard({ legacy: true })
const emit = defineEmits(['please-close-me', 'increment-hotp', 'validation-error'])
const props = defineProps({
@ -208,15 +208,17 @@
function copyOTP(otp, permit_closing) {
copy(otp.replace(/ /g, ''))
if(user.preferences.kickUserAfter == -1 && (permit_closing || false) === true) {
user.logout()
}
else if(user.preferences.closeOtpOnCopy && (permit_closing || false) === true) {
emit("please-close-me");
clearOTP()
}
if (copied) {
if(user.preferences.kickUserAfter == -1 && (permit_closing || false) === true) {
user.logout()
}
else if(user.preferences.closeOtpOnCopy && (permit_closing || false) === true) {
emit("please-close-me");
clearOTP()
}
notify.info({ text: trans('commons.copied_to_clipboard') })
notify.info({ text: trans('commons.copied_to_clipboard') })
}
}
/**