File tree Expand file tree Collapse file tree
dashboard/src/components/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 color =" error"
4343 variant =" tonal"
4444 :loading =" verifying"
45- :disabled =" !recoveryCode || recoveryCode.length < 5 "
45+ :disabled =" !isValidRecoveryCode "
4646 @click =" confirmDisable"
4747 >
4848 {{ tm('system_group.system.dashboard.totp.disableConfirm') }}
9191</template >
9292
9393<script setup>
94- import { ref } from ' vue'
94+ import { computed , ref } from ' vue'
9595import axios from ' axios'
9696import { useModuleI18n } from ' @/i18n/composables'
9797
@@ -104,6 +104,12 @@ const showRecovery = ref(false)
104104const verifying = ref (false )
105105const errorMsg = ref (' ' )
106106
107+ const isValidRecoveryCode = computed (() => {
108+ if (! recoveryCode .value ) return false
109+ const normalized = recoveryCode .value .replace (/ [^ A-Za-z0-9 ] / g , ' ' )
110+ return normalized .length === 32
111+ })
112+
107113function resetState () {
108114 code .value = ' '
109115 recoveryCode .value = ' '
You can’t perform that action at this time.
0 commit comments