merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移
- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛 - 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件 - 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖 - effect-events 单测补充 react-i18next mock - 对合并后仍不符合 Prettier 的文件做纯格式化
This commit is contained in:
@@ -231,7 +231,7 @@ const LoginForm = () => {
|
||||
nextParams.delete('expired');
|
||||
setSearchParams(nextParams, { replace: true });
|
||||
}
|
||||
}, []);
|
||||
}, [searchParams, setSearchParams, t]);
|
||||
|
||||
const finishLogin = useCallback(
|
||||
(data, successMessage) =>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useContext, useEffect } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -85,7 +86,7 @@ const OAuth2Callback = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
const code = searchParams.get('code');
|
||||
const state = searchParams.get('state');
|
||||
|
||||
@@ -97,7 +98,8 @@ const OAuth2Callback = (props) => {
|
||||
}
|
||||
|
||||
sendCode(code, state);
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
return <Loading />;
|
||||
};
|
||||
|
||||
@@ -502,136 +502,301 @@ const RegisterForm = () => {
|
||||
const renderOAuthOptions = () => {
|
||||
return (
|
||||
<GlassCard>
|
||||
<AuthCardHeader
|
||||
logo={logo}
|
||||
title={systemName}
|
||||
subtitle={t('创建您的账户')}
|
||||
/>
|
||||
<AuthCardHeader
|
||||
logo={logo}
|
||||
title={systemName}
|
||||
subtitle={t('创建您的账户')}
|
||||
/>
|
||||
|
||||
<div className='space-y-2'>
|
||||
{status.wechat_login && (
|
||||
<OAuthButton
|
||||
icon={<Icon svg={<WeChatIcon />} />}
|
||||
iconColor='#07C160'
|
||||
onClick={onWeChatLoginClicked}
|
||||
loading={wechatLoading}
|
||||
>
|
||||
{t('使用 微信 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.wechat_open_oauth && (
|
||||
<OAuthButton
|
||||
icon={<Icon svg={<WeChatIcon />} />}
|
||||
iconColor='#07C160'
|
||||
onClick={handleWeChatOpenClick}
|
||||
loading={wechatOpenLoading}
|
||||
>
|
||||
{t('使用 微信扫码 注册')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.github_oauth && (
|
||||
<OAuthButton
|
||||
icon={<IconGithubLogo size='large' />}
|
||||
onClick={handleGitHubClick}
|
||||
loading={githubLoading}
|
||||
disabled={githubButtonDisabled}
|
||||
>
|
||||
{t(githubButtonText)}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.discord_oauth && (
|
||||
<OAuthButton
|
||||
icon={<DiscordIcon />}
|
||||
iconColor='#5865F2'
|
||||
onClick={handleDiscordClick}
|
||||
loading={discordLoading}
|
||||
>
|
||||
{t('使用 Discord 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.oidc_enabled && (
|
||||
<OAuthButton
|
||||
icon={<OIDCIcon />}
|
||||
iconColor='#1877F2'
|
||||
onClick={handleOIDCClick}
|
||||
loading={oidcLoading}
|
||||
>
|
||||
{t('使用 OIDC 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.linuxdo_oauth && (
|
||||
<OAuthButton
|
||||
icon={<LinuxDoIcon style={{ width: '20px', height: '20px' }} />}
|
||||
iconColor='#E95420'
|
||||
onClick={handleLinuxDOClick}
|
||||
loading={linuxdoLoading}
|
||||
>
|
||||
{t('使用 LinuxDO 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.telegram_oauth && (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className='flex justify-center my-2 h-10 items-center text-gray-400 text-xs'>
|
||||
Loading...
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<TelegramLogin
|
||||
onAuth={onTelegramLoginClicked}
|
||||
botName={status.telegram_bot_name}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='relative py-3'>
|
||||
<div className='absolute inset-0 flex items-center'>
|
||||
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
|
||||
</div>
|
||||
<div className='relative flex justify-center'>
|
||||
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
|
||||
{t('或')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 用户名注册按钮 */}
|
||||
<button
|
||||
onClick={handleEmailRegisterClick}
|
||||
disabled={emailRegisterLoading}
|
||||
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 overflow-hidden'
|
||||
<div className='space-y-2'>
|
||||
{status.wechat_login && (
|
||||
<OAuthButton
|
||||
icon={<Icon svg={<WeChatIcon />} />}
|
||||
iconColor='#07C160'
|
||||
onClick={onWeChatLoginClicked}
|
||||
loading={wechatLoading}
|
||||
>
|
||||
{/* 闪光效果 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
|
||||
{t('使用 微信 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
<IconMail className='relative z-10' />
|
||||
<span className='relative z-10 font-medium text-sm'>
|
||||
{t('使用 用户名 注册')}
|
||||
</span>
|
||||
<ArrowRight
|
||||
size={16}
|
||||
className='relative z-10 group-hover:translate-x-1 transition-transform'
|
||||
{status.wechat_open_oauth && (
|
||||
<OAuthButton
|
||||
icon={<Icon svg={<WeChatIcon />} />}
|
||||
iconColor='#07C160'
|
||||
onClick={handleWeChatOpenClick}
|
||||
loading={wechatOpenLoading}
|
||||
>
|
||||
{t('使用 微信扫码 注册')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.github_oauth && (
|
||||
<OAuthButton
|
||||
icon={<IconGithubLogo size='large' />}
|
||||
onClick={handleGitHubClick}
|
||||
loading={githubLoading}
|
||||
disabled={githubButtonDisabled}
|
||||
>
|
||||
{t(githubButtonText)}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.discord_oauth && (
|
||||
<OAuthButton
|
||||
icon={<DiscordIcon />}
|
||||
iconColor='#5865F2'
|
||||
onClick={handleDiscordClick}
|
||||
loading={discordLoading}
|
||||
>
|
||||
{t('使用 Discord 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.oidc_enabled && (
|
||||
<OAuthButton
|
||||
icon={<OIDCIcon />}
|
||||
iconColor='#1877F2'
|
||||
onClick={handleOIDCClick}
|
||||
loading={oidcLoading}
|
||||
>
|
||||
{t('使用 OIDC 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.linuxdo_oauth && (
|
||||
<OAuthButton
|
||||
icon={<LinuxDoIcon style={{ width: '20px', height: '20px' }} />}
|
||||
iconColor='#E95420'
|
||||
onClick={handleLinuxDOClick}
|
||||
loading={linuxdoLoading}
|
||||
>
|
||||
{t('使用 LinuxDO 继续')}
|
||||
</OAuthButton>
|
||||
)}
|
||||
|
||||
{status.telegram_oauth && (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className='flex justify-center my-2 h-10 items-center text-gray-400 text-xs'>
|
||||
Loading...
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<TelegramLogin
|
||||
onAuth={onTelegramLoginClicked}
|
||||
botName={status.telegram_bot_name}
|
||||
/>
|
||||
</button>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='relative py-3'>
|
||||
<div className='absolute inset-0 flex items-center'>
|
||||
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
|
||||
</div>
|
||||
<div className='relative flex justify-center'>
|
||||
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
|
||||
{t('或')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 用户名注册按钮 */}
|
||||
<button
|
||||
onClick={handleEmailRegisterClick}
|
||||
disabled={emailRegisterLoading}
|
||||
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 overflow-hidden'
|
||||
>
|
||||
{/* 闪光效果 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
|
||||
|
||||
<IconMail className='relative z-10' />
|
||||
<span className='relative z-10 font-medium text-sm'>
|
||||
{t('使用 用户名 注册')}
|
||||
</span>
|
||||
<ArrowRight
|
||||
size={16}
|
||||
className='relative z-10 group-hover:translate-x-1 transition-transform'
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{(hasUserAgreement || hasPrivacyPolicy) && (
|
||||
<div className='mt-4 flex justify-center'>
|
||||
<Checkbox
|
||||
checked={agreedToTerms}
|
||||
onChange={(e) => setAgreedToTerms(e.target.checked)}
|
||||
>
|
||||
<Text
|
||||
size='small'
|
||||
className='text-gray-500 dark:text-gray-400 text-xs'
|
||||
>
|
||||
{t('我已阅读并同意')}
|
||||
{hasUserAgreement && (
|
||||
<a
|
||||
href='/user-agreement'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'agreement')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-1 font-medium transition-colors'
|
||||
>
|
||||
{t('用户协议')}
|
||||
</a>
|
||||
)}
|
||||
{hasUserAgreement && hasPrivacyPolicy && t('和')}
|
||||
{hasPrivacyPolicy && (
|
||||
<a
|
||||
href='/privacy-policy'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'privacy')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-1 font-medium transition-colors'
|
||||
>
|
||||
{t('隐私政策')}
|
||||
</a>
|
||||
)}
|
||||
</Text>
|
||||
</Checkbox>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='mt-4 text-center'>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('已有账户?')}{' '}
|
||||
<Link
|
||||
to='/login'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
|
||||
>
|
||||
{t('登录')}
|
||||
</Link>
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{/* 安全提示 */}
|
||||
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
|
||||
<Shield size={12} />
|
||||
<span>{t('安全注册')}</span>
|
||||
</div>
|
||||
</GlassCard>
|
||||
);
|
||||
};
|
||||
|
||||
const renderEmailRegisterForm = () => {
|
||||
return (
|
||||
<GlassCard>
|
||||
<AuthCardHeader
|
||||
logo={logo}
|
||||
title={systemName}
|
||||
subtitle={t('创建您的账户')}
|
||||
wrapperClassName='mb-4'
|
||||
logoWrapperClassName='mb-2'
|
||||
/>
|
||||
|
||||
<Form className='register-compact-form auth-glass-form'>
|
||||
{/* 用户名输入框 —— 玻璃观感统一由 .auth-glass-form(GlassCard 内置样式)驱动 */}
|
||||
<Form.Input
|
||||
field='username'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('用户名')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('请输入用户名')}
|
||||
name='username'
|
||||
size='large'
|
||||
autoComplete='username'
|
||||
onChange={(value) => handleChange('username', value)}
|
||||
prefix={<IconUser size='small' />}
|
||||
/>
|
||||
|
||||
{/* 密码输入框 */}
|
||||
<Form.Input
|
||||
field='password'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('密码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入密码,最短 8 位,最长 20 位')}
|
||||
name='password'
|
||||
mode='password'
|
||||
size='large'
|
||||
autoComplete='new-password'
|
||||
onChange={(value) => handleChange('password', value)}
|
||||
prefix={<IconLock size='small' />}
|
||||
/>
|
||||
|
||||
{/* 确认密码输入框 */}
|
||||
<Form.Input
|
||||
field='password2'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('确认密码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('确认密码')}
|
||||
name='password2'
|
||||
mode='password'
|
||||
size='large'
|
||||
autoComplete='new-password'
|
||||
onChange={(value) => handleChange('password2', value)}
|
||||
prefix={<IconLock size='small' />}
|
||||
/>
|
||||
|
||||
{showEmailVerification && (
|
||||
<>
|
||||
<Form.Input
|
||||
field='email'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('邮箱')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入邮箱地址')}
|
||||
name='email'
|
||||
type='email'
|
||||
size='large'
|
||||
autoComplete='email'
|
||||
onChange={(value) => handleChange('email', value)}
|
||||
prefix={<IconMail size='small' />}
|
||||
suffix={
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendVerificationCode}
|
||||
loading={verificationCodeLoading}
|
||||
disabled={disableButton || verificationCodeLoading}
|
||||
className='!rounded-lg'
|
||||
>
|
||||
{disableButton
|
||||
? `${t('重新发送')} (${countdown})`
|
||||
: t('获取验证码')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Form.Input
|
||||
field='verification_code'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('验证码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入验证码')}
|
||||
name='verification_code'
|
||||
size='large'
|
||||
onChange={(value) => handleChange('verification_code', value)}
|
||||
prefix={<IconKey size='small' />}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(hasUserAgreement || hasPrivacyPolicy) && (
|
||||
<div className='mt-4 flex justify-center'>
|
||||
<div className='flex items-center mt-3'>
|
||||
<Checkbox
|
||||
checked={agreedToTerms}
|
||||
onChange={(e) => setAgreedToTerms(e.target.checked)}
|
||||
>
|
||||
<Text
|
||||
size='small'
|
||||
className='text-gray-500 dark:text-gray-400 text-xs'
|
||||
>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('我已阅读并同意')}
|
||||
{hasUserAgreement && (
|
||||
<a
|
||||
@@ -639,7 +804,7 @@ const RegisterForm = () => {
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'agreement')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-1 font-medium transition-colors'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-0.5 font-medium transition-colors'
|
||||
>
|
||||
{t('用户协议')}
|
||||
</a>
|
||||
@@ -651,7 +816,7 @@ const RegisterForm = () => {
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'privacy')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-1 font-medium transition-colors'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-0.5 font-medium transition-colors'
|
||||
>
|
||||
{t('隐私政策')}
|
||||
</a>
|
||||
@@ -661,248 +826,83 @@ const RegisterForm = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='mt-4 text-center'>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('已有账户?')}{' '}
|
||||
<Link
|
||||
to='/login'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
|
||||
>
|
||||
{t('登录')}
|
||||
</Link>
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{/* 安全提示 */}
|
||||
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
|
||||
<Shield size={12} />
|
||||
<span>{t('安全注册')}</span>
|
||||
</div>
|
||||
</GlassCard>
|
||||
);
|
||||
};
|
||||
|
||||
const renderEmailRegisterForm = () => {
|
||||
return (
|
||||
<GlassCard>
|
||||
<AuthCardHeader
|
||||
logo={logo}
|
||||
title={systemName}
|
||||
subtitle={t('创建您的账户')}
|
||||
wrapperClassName='mb-4'
|
||||
logoWrapperClassName='mb-2'
|
||||
/>
|
||||
|
||||
<Form className='register-compact-form auth-glass-form'>
|
||||
{/* 用户名输入框 —— 玻璃观感统一由 .auth-glass-form(GlassCard 内置样式)驱动 */}
|
||||
<Form.Input
|
||||
field='username'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('用户名')}
|
||||
</span>
|
||||
<div className='space-y-2 mt-3'>
|
||||
{/* 注册按钮 */}
|
||||
<button
|
||||
type='submit'
|
||||
onClick={handleSubmit}
|
||||
disabled={
|
||||
registerLoading ||
|
||||
((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms)
|
||||
}
|
||||
placeholder={t('请输入用户名')}
|
||||
name='username'
|
||||
size='large'
|
||||
autoComplete='username'
|
||||
onChange={(value) => handleChange('username', value)}
|
||||
prefix={<IconUser size='small' />}
|
||||
/>
|
||||
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to disabled:from-gray-400 disabled:to-gray-500 text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 disabled:cursor-not-allowed disabled:hover:translate-y-0 overflow-hidden'
|
||||
>
|
||||
{/* 闪光效果 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
|
||||
|
||||
{/* 密码输入框 */}
|
||||
<Form.Input
|
||||
field='password'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('密码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入密码,最短 8 位,最长 20 位')}
|
||||
name='password'
|
||||
mode='password'
|
||||
size='large'
|
||||
autoComplete='new-password'
|
||||
onChange={(value) => handleChange('password', value)}
|
||||
prefix={<IconLock size='small' />}
|
||||
/>
|
||||
|
||||
{/* 确认密码输入框 */}
|
||||
<Form.Input
|
||||
field='password2'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('确认密码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('确认密码')}
|
||||
name='password2'
|
||||
mode='password'
|
||||
size='large'
|
||||
autoComplete='new-password'
|
||||
onChange={(value) => handleChange('password2', value)}
|
||||
prefix={<IconLock size='small' />}
|
||||
/>
|
||||
|
||||
{showEmailVerification && (
|
||||
<>
|
||||
<Form.Input
|
||||
field='email'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('邮箱')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入邮箱地址')}
|
||||
name='email'
|
||||
type='email'
|
||||
size='large'
|
||||
autoComplete='email'
|
||||
onChange={(value) => handleChange('email', value)}
|
||||
prefix={<IconMail size='small' />}
|
||||
suffix={
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendVerificationCode}
|
||||
loading={verificationCodeLoading}
|
||||
disabled={disableButton || verificationCodeLoading}
|
||||
className='!rounded-lg'
|
||||
>
|
||||
{disableButton
|
||||
? `${t('重新发送')} (${countdown})`
|
||||
: t('获取验证码')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Form.Input
|
||||
field='verification_code'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('验证码')}
|
||||
</span>
|
||||
}
|
||||
placeholder={t('输入验证码')}
|
||||
name='verification_code'
|
||||
size='large'
|
||||
onChange={(value) => handleChange('verification_code', value)}
|
||||
prefix={<IconKey size='small' />}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(hasUserAgreement || hasPrivacyPolicy) && (
|
||||
<div className='flex items-center mt-3'>
|
||||
<Checkbox
|
||||
checked={agreedToTerms}
|
||||
onChange={(e) => setAgreedToTerms(e.target.checked)}
|
||||
>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('我已阅读并同意')}
|
||||
{hasUserAgreement && (
|
||||
<a
|
||||
href='/user-agreement'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'agreement')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-0.5 font-medium transition-colors'
|
||||
>
|
||||
{t('用户协议')}
|
||||
</a>
|
||||
)}
|
||||
{hasUserAgreement && hasPrivacyPolicy && t('和')}
|
||||
{hasPrivacyPolicy && (
|
||||
<a
|
||||
href='/privacy-policy'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
onClick={(e) => openAgreement(e, 'privacy')}
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from mx-0.5 font-medium transition-colors'
|
||||
>
|
||||
{t('隐私政策')}
|
||||
</a>
|
||||
)}
|
||||
</Text>
|
||||
</Checkbox>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='space-y-2 mt-3'>
|
||||
{/* 注册按钮 */}
|
||||
<button
|
||||
type='submit'
|
||||
onClick={handleSubmit}
|
||||
disabled={
|
||||
registerLoading ||
|
||||
((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms)
|
||||
}
|
||||
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to disabled:from-gray-400 disabled:to-gray-500 text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 disabled:cursor-not-allowed disabled:hover:translate-y-0 overflow-hidden'
|
||||
>
|
||||
{/* 闪光效果 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
|
||||
|
||||
{registerLoading ? (
|
||||
<div className='w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin' />
|
||||
) : (
|
||||
<>
|
||||
<span className='relative z-10 font-semibold'>
|
||||
{t('注 册')}
|
||||
</span>
|
||||
<ArrowRight
|
||||
size={16}
|
||||
className='relative z-10 group-hover:translate-x-1 transition-transform'
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
{(status.github_oauth ||
|
||||
status.discord_oauth ||
|
||||
status.oidc_enabled ||
|
||||
status.wechat_login ||
|
||||
status.wechat_open_oauth ||
|
||||
status.linuxdo_oauth ||
|
||||
status.telegram_oauth) && (
|
||||
<div className='mt-2'>
|
||||
<div className='relative py-3'>
|
||||
<div className='absolute inset-0 flex items-center'>
|
||||
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
|
||||
</div>
|
||||
<div className='relative flex justify-center'>
|
||||
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
|
||||
{t('或')}
|
||||
{registerLoading ? (
|
||||
<div className='w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin' />
|
||||
) : (
|
||||
<>
|
||||
<span className='relative z-10 font-semibold'>
|
||||
{t('注 册')}
|
||||
</span>
|
||||
</div>
|
||||
<ArrowRight
|
||||
size={16}
|
||||
className='relative z-10 group-hover:translate-x-1 transition-transform'
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
{(status.github_oauth ||
|
||||
status.discord_oauth ||
|
||||
status.oidc_enabled ||
|
||||
status.wechat_login ||
|
||||
status.wechat_open_oauth ||
|
||||
status.linuxdo_oauth ||
|
||||
status.telegram_oauth) && (
|
||||
<div className='mt-2'>
|
||||
<div className='relative py-3'>
|
||||
<div className='absolute inset-0 flex items-center'>
|
||||
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
|
||||
</div>
|
||||
<div className='relative flex justify-center'>
|
||||
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
|
||||
{t('或')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={handleOtherRegisterOptionsClick}
|
||||
disabled={otherRegisterOptionsLoading}
|
||||
className='w-full h-9 flex items-center justify-center gap-2 text-sm text-gray-600 dark:text-gray-300 border border-gray-200/80 dark:border-white/[0.12] rounded-lg hover:bg-gray-50 dark:hover:bg-white/[0.06] hover:border-gray-300 dark:hover:border-white/20 transition-all'
|
||||
>
|
||||
{t('其他注册选项')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='mt-4 text-center'>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('已有账户?')}{' '}
|
||||
<Link
|
||||
to='/login'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
|
||||
>
|
||||
{t('登录')}
|
||||
</Link>
|
||||
</Text>
|
||||
<button
|
||||
onClick={handleOtherRegisterOptionsClick}
|
||||
disabled={otherRegisterOptionsLoading}
|
||||
className='w-full h-9 flex items-center justify-center gap-2 text-sm text-gray-600 dark:text-gray-300 border border-gray-200/80 dark:border-white/[0.12] rounded-lg hover:bg-gray-50 dark:hover:bg-white/[0.06] hover:border-gray-300 dark:hover:border-white/20 transition-all'
|
||||
>
|
||||
{t('其他注册选项')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 安全提示 */}
|
||||
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
|
||||
<Shield size={12} />
|
||||
<span>{t('安全注册')}</span>
|
||||
</div>
|
||||
<div className='mt-4 text-center'>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('已有账户?')}{' '}
|
||||
<Link
|
||||
to='/login'
|
||||
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
|
||||
>
|
||||
{t('登录')}
|
||||
</Link>
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{/* 安全提示 */}
|
||||
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
|
||||
<Shield size={12} />
|
||||
<span>{t('安全注册')}</span>
|
||||
</div>
|
||||
</GlassCard>
|
||||
);
|
||||
};
|
||||
@@ -1072,16 +1072,16 @@ const RegisterForm = () => {
|
||||
const renderSkeleton = () => {
|
||||
return (
|
||||
<GlassCard withCornerHalos={false} withAurora={false}>
|
||||
<div className='flex flex-col items-center justify-center mb-5'>
|
||||
<div className='w-14 h-14 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse mb-3' />
|
||||
<div className='w-24 h-5 rounded bg-gray-200/60 dark:bg-white/10 animate-pulse mb-1' />
|
||||
<div className='w-32 h-3 rounded bg-gray-100/80 dark:bg-white/5 animate-pulse' />
|
||||
</div>
|
||||
<div className='space-y-2'>
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
</div>
|
||||
<div className='flex flex-col items-center justify-center mb-5'>
|
||||
<div className='w-14 h-14 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse mb-3' />
|
||||
<div className='w-24 h-5 rounded bg-gray-200/60 dark:bg-white/10 animate-pulse mb-1' />
|
||||
<div className='w-32 h-3 rounded bg-gray-100/80 dark:bg-white/5 animate-pulse' />
|
||||
</div>
|
||||
<div className='space-y-2'>
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
<div className='w-full h-10 rounded-xl bg-gray-200/60 dark:bg-white/10 animate-pulse' />
|
||||
</div>
|
||||
</GlassCard>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,13 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Divider,
|
||||
Form,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Button, Card, Divider, Form, Typography } from '@/components/ui';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user