merge: upstream
This commit is contained in:
commit
7552cea69a
413 changed files with 5517 additions and 2309 deletions
|
|
@ -67,6 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #prefix><i class="ph-chalkboard-teacher ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
<MkCaptcha v-if="instance.enableHcaptcha" ref="hcaptcha" v-model="hCaptchaResponse" :class="$style.captcha" provider="hcaptcha" :sitekey="instance.hcaptchaSiteKey"/>
|
||||
<MkCaptcha v-if="instance.enableMcaptcha" ref="mcaptcha" v-model="mCaptchaResponse" :class="$style.captcha" provider="mcaptcha" :sitekey="instance.mcaptchaSiteKey" :instanceUrl="instance.mcaptchaInstanceUrl"/>
|
||||
<MkCaptcha v-if="instance.enableRecaptcha" ref="recaptcha" v-model="reCaptchaResponse" :class="$style.captcha" provider="recaptcha" :sitekey="instance.recaptchaSiteKey"/>
|
||||
<MkCaptcha v-if="instance.enableTurnstile" ref="turnstile" v-model="turnstileResponse" :class="$style.captcha" provider="turnstile" :sitekey="instance.turnstileSiteKey"/>
|
||||
<MkButton type="submit" :disabled="shouldDisableSubmitting" large gradate rounded data-cy-signup-submit style="margin: 0 auto;">
|
||||
|
|
@ -88,6 +89,7 @@ import MkInput from './MkInput.vue';
|
|||
import MkCaptcha, { type Captcha } from '@/components/MkCaptcha.vue';
|
||||
import * as config from '@/config.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { login } from '@/account.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
|
@ -122,6 +124,7 @@ const passwordStrength = ref<'' | 'low' | 'medium' | 'high'>('');
|
|||
const passwordRetypeState = ref<null | 'match' | 'not-match'>(null);
|
||||
const submitting = ref<boolean>(false);
|
||||
const hCaptchaResponse = ref<string | null>(null);
|
||||
const mCaptchaResponse = ref<string | null>(null);
|
||||
const reCaptchaResponse = ref<string | null>(null);
|
||||
const turnstileResponse = ref<string | null>(null);
|
||||
const usernameAbortController = ref<null | AbortController>(null);
|
||||
|
|
@ -130,6 +133,7 @@ const emailAbortController = ref<null | AbortController>(null);
|
|||
const shouldDisableSubmitting = computed((): boolean => {
|
||||
return submitting.value ||
|
||||
instance.enableHcaptcha && !hCaptchaResponse.value ||
|
||||
instance.enableMcaptcha && !mCaptchaResponse.value ||
|
||||
instance.enableRecaptcha && !reCaptchaResponse.value ||
|
||||
instance.enableTurnstile && !turnstileResponse.value ||
|
||||
instance.emailRequiredForSignup && emailState.value !== 'ok' ||
|
||||
|
|
@ -186,7 +190,7 @@ function onChangeUsername(): void {
|
|||
usernameState.value = 'wait';
|
||||
usernameAbortController.value = new AbortController();
|
||||
|
||||
os.api('username/available', {
|
||||
misskeyApi('username/available', {
|
||||
username: username.value,
|
||||
}, undefined, usernameAbortController.value.signal).then(result => {
|
||||
usernameState.value = result.available ? 'ok' : 'unavailable';
|
||||
|
|
@ -209,7 +213,7 @@ function onChangeEmail(): void {
|
|||
emailState.value = 'wait';
|
||||
emailAbortController.value = new AbortController();
|
||||
|
||||
os.api('email-address/available', {
|
||||
misskeyApi('email-address/available', {
|
||||
emailAddress: email.value,
|
||||
}, undefined, emailAbortController.value.signal).then(result => {
|
||||
emailState.value = result.available ? 'ok' :
|
||||
|
|
@ -251,13 +255,14 @@ async function onSubmit(): Promise<void> {
|
|||
submitting.value = true;
|
||||
|
||||
try {
|
||||
await os.api('signup', {
|
||||
await misskeyApi('signup', {
|
||||
username: username.value,
|
||||
password: password.value,
|
||||
emailAddress: email.value,
|
||||
invitationCode: invitationCode.value,
|
||||
reason: reason.value,
|
||||
'hcaptcha-response': hCaptchaResponse.value,
|
||||
'm-captcha-response': mCaptchaResponse.value,
|
||||
'g-recaptcha-response': reCaptchaResponse.value,
|
||||
});
|
||||
if (instance.emailRequiredForSignup) {
|
||||
|
|
@ -275,7 +280,7 @@ async function onSubmit(): Promise<void> {
|
|||
});
|
||||
emit('approvalPending');
|
||||
} else {
|
||||
const res = await os.api('signin', {
|
||||
const res = await misskeyApi('signin', {
|
||||
username: username.value,
|
||||
password: password.value,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue