mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-23 06:38:34 +01:00
Check copy state before notifying
This commit is contained in:
parent
68d98652a3
commit
4055a52daf
@ -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') })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user