-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to HCaptcha for Auth-related captchas (#2945)
* Switch to HCaptcha for Auth-related captchas * run fmt
- Loading branch information
1 parent
5ab1263
commit b188b3f
Showing
12 changed files
with
117 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<script setup> | ||
const token = defineModel(); | ||
useHead({ | ||
script: [ | ||
{ | ||
src: "https://js.hcaptcha.com/1/api.js", | ||
async: true, | ||
defer: true, | ||
}, | ||
], | ||
}); | ||
function updateToken(newToken) { | ||
token.value = newToken; | ||
} | ||
onMounted(() => { | ||
window.updateCatpchaToken = updateToken; | ||
}); | ||
defineExpose({ | ||
reset: () => { | ||
token.value = null; | ||
window.hcaptcha.reset(); | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div | ||
id="h-captcha" | ||
class="h-captcha" | ||
data-sitekey="4a7a2c80-68f2-4190-9d52-131c76e0c14e" | ||
:data-theme="$theme.active === 'light' ? 'light' : 'dark'" | ||
data-callback="updateCatpchaToken" | ||
></div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.h-captcha { | ||
display: flex; | ||
justify-content: center; | ||
overflow: hidden; | ||
border-radius: var(--radius-md); | ||
border: 2px solid var(--color-button-bg); | ||
height: 78px; | ||
iframe { | ||
margin: -1px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.