diff --git a/frontend/src/i18n/lang/en.json b/frontend/src/i18n/lang/en.json index 1025f6526..d10f8928b 100644 --- a/frontend/src/i18n/lang/en.json +++ b/frontend/src/i18n/lang/en.json @@ -104,7 +104,8 @@ "remember": "Stay logged in", "registrationDisabled": "Registration is disabled.", "passwordResetTokenMissing": "Password reset token is missing.", - "registrationFailed": "An error occurred during registration. Please check your input and try again." + "registrationFailed": "An error occurred during registration. Please check your input and try again.", + "registrationConfirmEmail": "Your account was created successfully! Please check your inbox and click the link in the confirmation email before logging in." }, "settings": { "bots": { diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index e1173bf10..b7aa29138 100644 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -238,12 +238,12 @@ export const useAuthStore = defineStore('auth', () => { ...credentials, language, }) - return login(credentials) + return await login(credentials) } catch (e) { if (e.response?.data?.code === 2002 && e.response?.data?.invalid_fields[0]?.startsWith('language:')) { return register(credentials, 'en') } - + if (e.response?.data?.message) { throw e.response.data } diff --git a/frontend/src/views/user/Register.vue b/frontend/src/views/user/Register.vue index 896ac657b..ddfb61115 100644 --- a/frontend/src/views/user/Register.vue +++ b/frontend/src/views/user/Register.vue @@ -7,6 +7,13 @@ > {{ errorMessage }} + + {{ confirmEmailMessage }} +
authStore.isLoading) const errorMessage = ref('') +const confirmEmailMessage = ref('') const validatePasswordInitially = ref(false) const serverValidationErrors = ref>>({}) @@ -233,6 +241,12 @@ async function submit() { await authStore.register(toRaw(credentials)) redirectIfSaved() } catch (e: unknown) { + // 1012 = email not confirmed: registration itself succeeded + if (e instanceof Object && 'code' in e && e.code === 1012) { + confirmEmailMessage.value = t('user.auth.registrationConfirmEmail') + return + } + // Parse field-specific validation errors if (isApiValidationError(e)) { const fieldErrors = parseValidationErrors(e)