From ef9803f8b98b7ffff593ea695fd20c0d5447d618 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:15:07 +0800 Subject: [PATCH] refactor(web): migrate auth toast calls to ui toast (#33744) --- .../webapp-reset-password/check-code/page.tsx | 10 +-- .../webapp-reset-password/page.tsx | 16 ++--- .../set-password/page.tsx | 6 +- .../webapp-signin/check-code/page.tsx | 14 ++-- .../components/external-member-sso-auth.tsx | 6 +- .../components/mail-and-code-auth.tsx | 8 +-- .../components/mail-and-password-auth.tsx | 20 +++--- .../webapp-signin/components/sso-auth.tsx | 10 +-- .../forgot-password/ChangePasswordForm.tsx | 6 +- web/app/reset-password/check-code/page.tsx | 10 +-- web/app/reset-password/page.tsx | 12 ++-- web/app/reset-password/set-password/page.tsx | 6 +- web/app/signin/check-code/page.tsx | 10 +-- .../signin/components/mail-and-code-auth.tsx | 8 +-- web/app/signin/components/sso-auth.tsx | 6 +- web/app/signin/normal-form.tsx | 6 +- web/app/signup/check-code/page.tsx | 14 ++-- web/app/signup/components/input-mail.tsx | 8 +-- web/app/signup/set-password/page.tsx | 10 +-- web/eslint-suppressions.json | 69 ------------------- web/i18n/en-US/login.json | 2 + 21 files changed, 95 insertions(+), 162 deletions(-) diff --git a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx index a0aa86e35b..6a4e71f574 100644 --- a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' @@ -24,16 +24,16 @@ export default function CheckCode() { const verify = async () => { try { if (!code.trim()) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.emptyCode', { ns: 'login' }), + title: t('checkCode.emptyCode', { ns: 'login' }), }) return } if (!/\d{6}/.test(code)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) return } diff --git a/web/app/(shareLayout)/webapp-reset-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/page.tsx index 3763e0bb2a..08a42478aa 100644 --- a/web/app/(shareLayout)/webapp-reset-password/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/page.tsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' @@ -27,14 +27,14 @@ export default function CheckCode() { const handleGetEMailVerificationCode = async () => { try { if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } @@ -48,15 +48,15 @@ export default function CheckCode() { router.push(`/webapp-reset-password/check-code?${params.toString()}`) } else if (res.code === 'account_not_found') { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.registrationNotAllowed', { ns: 'login' }), + title: t('error.registrationNotAllowed', { ns: 'login' }), }) } else { - Toast.notify({ + toast.add({ type: 'error', - message: res.data, + title: res.data, }) } } diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx index 1a97f6440b..22d2d22879 100644 --- a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx @@ -5,7 +5,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { changeWebAppPasswordWithToken } from '@/service/common' @@ -24,9 +24,9 @@ const ChangePasswordForm = () => { const [showConfirmPassword, setShowConfirmPassword] = useState(false) const showErrorMessage = useCallback((message: string) => { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) }, []) diff --git a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx index 81b7c1b9a6..603369a858 100644 --- a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx @@ -5,7 +5,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useWebAppStore } from '@/context/web-app-context' @@ -43,23 +43,23 @@ export default function CheckCode() { try { const appCode = getAppCodeFromRedirectUrl() if (!code.trim()) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.emptyCode', { ns: 'login' }), + title: t('checkCode.emptyCode', { ns: 'login' }), }) return } if (!/\d{6}/.test(code)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) return } if (!redirectUrl || !appCode) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.redirectUrlMissing', { ns: 'login' }), + title: t('error.redirectUrlMissing', { ns: 'login' }), }) return } diff --git a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx index 391479c870..b7fb7036e8 100644 --- a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx @@ -3,7 +3,7 @@ import * as React from 'react' import { useCallback, useEffect } from 'react' import AppUnavailable from '@/app/components/base/app-unavailable' import Loading from '@/app/components/base/loading' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useGlobalPublicStore } from '@/context/global-public-context' import { useRouter, useSearchParams } from '@/next/navigation' import { fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share' @@ -17,9 +17,9 @@ const ExternalMemberSSOAuth = () => { const redirectUrl = searchParams.get('redirect_url') const showErrorToast = (message: string) => { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) } diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx index b350549784..7a20713e05 100644 --- a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx @@ -3,7 +3,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' @@ -22,14 +22,14 @@ export default function MailAndCodeAuth() { const handleGetEMailVerificationCode = async () => { try { if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx index 87419438e3..bbc4cc8efd 100644 --- a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx @@ -4,7 +4,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' import { useWebAppStore } from '@/context/web-app-context' @@ -46,25 +46,25 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut const appCode = getAppCodeFromRedirectUrl() const handleEmailPasswordLogin = async () => { if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } if (!password?.trim()) { - Toast.notify({ type: 'error', message: t('error.passwordEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.passwordEmpty', { ns: 'login' }) }) return } if (!redirectUrl || !appCode) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.redirectUrlMissing', { ns: 'login' }), + title: t('error.redirectUrlMissing', { ns: 'login' }), }) return } @@ -94,15 +94,15 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut router.replace(decodeURIComponent(redirectUrl)) } else { - Toast.notify({ + toast.add({ type: 'error', - message: res.data, + title: res.data, }) } } catch (e: any) { if (e.code === 'authentication_failed') - Toast.notify({ type: 'error', message: e.message }) + toast.add({ type: 'error', title: e.message }) } finally { setIsLoading(false) diff --git a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx index 79d67dde5c..fd12c2060f 100644 --- a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx @@ -4,7 +4,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useRouter, useSearchParams } from '@/next/navigation' import { fetchMembersOAuth2SSOUrl, fetchMembersOIDCSSOUrl, fetchMembersSAMLSSOUrl } from '@/service/share' import { SSOProtocol } from '@/types/feature' @@ -37,9 +37,9 @@ const SSOAuth: FC = ({ const handleSSOLogin = () => { const appCode = getAppCodeFromRedirectUrl() if (!redirectUrl || !appCode) { - Toast.notify({ + toast.add({ type: 'error', - message: 'invalid redirect URL or app code', + title: t('error.invalidRedirectUrlOrAppCode', { ns: 'login' }), }) return } @@ -66,9 +66,9 @@ const SSOAuth: FC = ({ }) } else { - Toast.notify({ + toast.add({ type: 'error', - message: 'invalid SSO protocol', + title: t('error.invalidSSOProtocol', { ns: 'login' }), }) setIsLoading(false) } diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsx index 00f61cab2c..e586148d9e 100644 --- a/web/app/forgot-password/ChangePasswordForm.tsx +++ b/web/app/forgot-password/ChangePasswordForm.tsx @@ -4,7 +4,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Loading from '@/app/components/base/loading' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useSearchParams } from '@/next/navigation' import { changePasswordWithToken } from '@/service/common' @@ -29,9 +29,9 @@ const ChangePasswordForm = () => { const [showSuccess, setShowSuccess] = useState(false) const showErrorMessage = useCallback((message: string) => { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) }, []) diff --git a/web/app/reset-password/check-code/page.tsx b/web/app/reset-password/check-code/page.tsx index aac73b8e7d..e4a630ab11 100644 --- a/web/app/reset-password/check-code/page.tsx +++ b/web/app/reset-password/check-code/page.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useRouter, useSearchParams } from '@/next/navigation' @@ -23,16 +23,16 @@ export default function CheckCode() { const verify = async () => { try { if (!code.trim()) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.emptyCode', { ns: 'login' }), + title: t('checkCode.emptyCode', { ns: 'login' }), }) return } if (!/\d{6}/.test(code)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) return } diff --git a/web/app/reset-password/page.tsx b/web/app/reset-password/page.tsx index af9dc544a6..03ec54434b 100644 --- a/web/app/reset-password/page.tsx +++ b/web/app/reset-password/page.tsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' import useDocumentTitle from '@/hooks/use-document-title' @@ -26,14 +26,14 @@ export default function CheckCode() { const handleGetEMailVerificationCode = async () => { try { if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } @@ -47,9 +47,9 @@ export default function CheckCode() { router.push(`/reset-password/check-code?${params.toString()}`) } else { - Toast.notify({ + toast.add({ type: 'error', - message: res.data, + title: res.data, }) } } diff --git a/web/app/reset-password/set-password/page.tsx b/web/app/reset-password/set-password/page.tsx index e187bb28cb..26c301d1df 100644 --- a/web/app/reset-password/set-password/page.tsx +++ b/web/app/reset-password/set-password/page.tsx @@ -5,7 +5,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { changePasswordWithToken } from '@/service/common' @@ -24,9 +24,9 @@ const ChangePasswordForm = () => { const [showConfirmPassword, setShowConfirmPassword] = useState(false) const showErrorMessage = useCallback((message: string) => { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) }, []) diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsx index dfd346e502..650c401804 100644 --- a/web/app/signin/check-code/page.tsx +++ b/web/app/signin/check-code/page.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' @@ -31,16 +31,16 @@ export default function CheckCode() { const verify = async () => { try { if (!code.trim()) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.emptyCode', { ns: 'login' }), + title: t('checkCode.emptyCode', { ns: 'login' }), }) return } if (!/\d{6}/.test(code)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) return } diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsx index 86fc0db36b..e3acc0e4ba 100644 --- a/web/app/signin/components/mail-and-code-auth.tsx +++ b/web/app/signin/components/mail-and-code-auth.tsx @@ -3,7 +3,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' @@ -26,14 +26,14 @@ export default function MailAndCodeAuth({ isInvite }: MailAndCodeAuthProps) { const handleGetEMailVerificationCode = async () => { try { if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } diff --git a/web/app/signin/components/sso-auth.tsx b/web/app/signin/components/sso-auth.tsx index 904403ab2c..a7bc413665 100644 --- a/web/app/signin/components/sso-auth.tsx +++ b/web/app/signin/components/sso-auth.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useRouter, useSearchParams } from '@/next/navigation' import { getUserOAuth2SSOUrl, getUserOIDCSSOUrl, getUserSAMLSSOUrl } from '@/service/sso' import { SSOProtocol } from '@/types/feature' @@ -49,9 +49,9 @@ const SSOAuth: FC = ({ }) } else { - Toast.notify({ + toast.add({ type: 'error', - message: 'invalid SSO protocol', + title: t('error.invalidSSOProtocol', { ns: 'login' }), }) setIsLoading(false) } diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsx index 1916dd6d1c..fa0d3c8078 100644 --- a/web/app/signin/normal-form.tsx +++ b/web/app/signin/normal-form.tsx @@ -2,7 +2,7 @@ import { RiContractLine, RiDoorLockLine, RiErrorWarningFill } from '@remixicon/r import * as React from 'react' import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { IS_CE_EDITION } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' import Link from '@/next/link' @@ -48,9 +48,9 @@ const NormalForm = () => { } if (message) { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) } setAllMethodsAreDisabled(!systemFeatures.enable_social_oauth_login && !systemFeatures.enable_email_code_login && !systemFeatures.enable_email_password_login && !systemFeatures.sso_enforced_for_signin) diff --git a/web/app/signup/check-code/page.tsx b/web/app/signup/check-code/page.tsx index 00abc280f8..f4cc272e5a 100644 --- a/web/app/signup/check-code/page.tsx +++ b/web/app/signup/check-code/page.tsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useRouter, useSearchParams } from '@/next/navigation' @@ -26,16 +26,16 @@ export default function CheckCode() { const verify = async () => { try { if (!code.trim()) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.emptyCode', { ns: 'login' }), + title: t('checkCode.emptyCode', { ns: 'login' }), }) return } if (!/\d{6}/.test(code)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) return } @@ -47,9 +47,9 @@ export default function CheckCode() { router.push(`/signup/set-password?${params.toString()}`) } else { - Toast.notify({ + toast.add({ type: 'error', - message: t('checkCode.invalidCode', { ns: 'login' }), + title: t('checkCode.invalidCode', { ns: 'login' }), }) } } diff --git a/web/app/signup/components/input-mail.tsx b/web/app/signup/components/input-mail.tsx index d6c4b95ce3..3f26202965 100644 --- a/web/app/signup/components/input-mail.tsx +++ b/web/app/signup/components/input-mail.tsx @@ -4,7 +4,7 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Split from '@/app/signin/split' import { emailRegex } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' @@ -30,13 +30,13 @@ export default function Form({ return if (!email) { - Toast.notify({ type: 'error', message: t('error.emailEmpty', { ns: 'login' }) }) + toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) }) return } if (!emailRegex.test(email)) { - Toast.notify({ + toast.add({ type: 'error', - message: t('error.emailInValid', { ns: 'login' }), + title: t('error.emailInValid', { ns: 'login' }), }) return } diff --git a/web/app/signup/set-password/page.tsx b/web/app/signup/set-password/page.tsx index c38fe68803..42ffb0843d 100644 --- a/web/app/signup/set-password/page.tsx +++ b/web/app/signup/set-password/page.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { useMailRegister } from '@/service/use-common' @@ -37,9 +37,9 @@ const ChangePasswordForm = () => { const { mutateAsync: register, isPending } = useMailRegister() const showErrorMessage = useCallback((message: string) => { - Toast.notify({ + toast.add({ type: 'error', - message, + title: message, }) }, []) @@ -82,9 +82,9 @@ const ChangePasswordForm = () => { }) Cookies.remove('utm_info') // Clean up: remove utm_info cookie - Toast.notify({ + toast.add({ type: 'success', - message: t('api.actionSuccess', { ns: 'common' }), + title: t('api.actionSuccess', { ns: 'common' }), }) router.replace('/apps') } diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index fdf2b43e92..218ff71721 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -189,9 +189,6 @@ } }, "app/(shareLayout)/webapp-reset-password/check-code/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } @@ -205,46 +202,26 @@ } }, "app/(shareLayout)/webapp-reset-password/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } }, "app/(shareLayout)/webapp-reset-password/set-password/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 6 } }, "app/(shareLayout)/webapp-signin/check-code/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } }, - "app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 1 } }, "app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 2 }, @@ -252,11 +229,6 @@ "count": 2 } }, - "app/(shareLayout)/webapp-signin/components/sso-auth.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/(shareLayout)/webapp-signin/layout.tsx": { "tailwindcss/enforce-consistent-class-order": { "count": 1 @@ -9277,11 +9249,6 @@ "count": 5 } }, - "app/forgot-password/ChangePasswordForm.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/forgot-password/ForgotPasswordForm.spec.tsx": { "ts/no-explicit-any": { "count": 5 @@ -9306,9 +9273,6 @@ } }, "app/reset-password/check-code/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } @@ -9322,17 +9286,11 @@ } }, "app/reset-password/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } }, "app/reset-password/set-password/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 6 } @@ -9342,15 +9300,7 @@ "count": 1 } }, - "app/signin/check-code/page.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/signin/components/mail-and-code-auth.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 1 } @@ -9360,11 +9310,6 @@ "count": 1 } }, - "app/signin/components/sso-auth.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/signin/invite-settings/page.tsx": { "no-restricted-imports": { "count": 2 @@ -9378,11 +9323,6 @@ "count": 1 } }, - "app/signin/normal-form.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "app/signin/one-more-step.tsx": { "no-restricted-imports": { "count": 3 @@ -9395,17 +9335,11 @@ } }, "app/signup/check-code/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } }, "app/signup/components/input-mail.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } @@ -9424,9 +9358,6 @@ } }, "app/signup/set-password/page.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 5 } diff --git a/web/i18n/en-US/login.json b/web/i18n/en-US/login.json index 8a3bf04ac9..ec474aa4fb 100644 --- a/web/i18n/en-US/login.json +++ b/web/i18n/en-US/login.json @@ -35,6 +35,8 @@ "error.emailEmpty": "Email address is required", "error.emailInValid": "Please enter a valid email address", "error.invalidEmailOrPassword": "Invalid email or password.", + "error.invalidRedirectUrlOrAppCode": "Invalid redirect URL or app code", + "error.invalidSSOProtocol": "Invalid SSO protocol", "error.nameEmpty": "Name is required", "error.passwordEmpty": "Password is required", "error.passwordInvalid": "Password must contain letters and numbers, and the length must be greater than 8",