mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
Merge branch 'feat/auth-methods' into deploy/dev
This commit is contained in:
commit
f9047c4352
|
@ -95,7 +95,7 @@ const ChangePasswordForm = () => {
|
|||
<div className='flex flex-col md:w-[400px]'>
|
||||
<div className="w-full mx-auto">
|
||||
<h2 className="title-4xl-semi-bold text-text-primary">
|
||||
{t('login.resetPassword')}
|
||||
{t('login.changePassword')}
|
||||
</h2>
|
||||
<p className='mt-2 body-md-regular text-text-secondary'>
|
||||
{t('login.changePasswordTip')}
|
||||
|
@ -139,7 +139,7 @@ const ChangePasswordForm = () => {
|
|||
className='w-full'
|
||||
onClick={handleChangePassword}
|
||||
>
|
||||
{t('common.operation.reset')}
|
||||
{t('login.changePasswordBtn')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -40,8 +40,11 @@ export default function CheckCode() {
|
|||
}
|
||||
setIsLoading(true)
|
||||
const ret = await emailLoginWithCode({ email, code, token })
|
||||
localStorage.setItem('console_token', ret.data)
|
||||
router.replace(invite_token ? `/signin/invite-settings?${searchParams.toString()}` : '/apps')
|
||||
if (ret.result === 'success') {
|
||||
localStorage.setItem('console_token', ret.data.access_token)
|
||||
localStorage.setItem('refresh_token', ret.data.refresh_token)
|
||||
router.replace(invite_token ? `/signin/invite-settings?${searchParams.toString()}` : '/apps')
|
||||
}
|
||||
}
|
||||
catch (error) { console.error(error) }
|
||||
finally {
|
||||
|
|
|
@ -2,11 +2,13 @@ import Link from 'next/link'
|
|||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { useContext } from 'use-context-selector'
|
||||
import Button from '@/app/components/base/button'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { emailRegex } from '@/config'
|
||||
import { login } from '@/service/common'
|
||||
import Input from '@/app/components/base/input'
|
||||
import I18NContext from '@/context/i18n'
|
||||
|
||||
type MailAndPasswordAuthProps = {
|
||||
isInvite: boolean
|
||||
|
@ -14,6 +16,7 @@ type MailAndPasswordAuthProps = {
|
|||
|
||||
export default function MailAndPasswordAuth({ isInvite }: MailAndPasswordAuthProps) {
|
||||
const { t } = useTranslation()
|
||||
const { locale } = useContext(I18NContext)
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [showPassword, setShowPassword] = useState(false)
|
||||
|
@ -39,6 +42,7 @@ export default function MailAndPasswordAuth({ isInvite }: MailAndPasswordAuthPro
|
|||
const loginData: Record<string, any> = {
|
||||
email,
|
||||
password,
|
||||
language: locale,
|
||||
remember_me: true,
|
||||
}
|
||||
if (isInvite)
|
||||
|
|
|
@ -47,8 +47,9 @@ const translation = {
|
|||
forgotPasswordDesc: 'Please enter your email address to reset your password. We will send you an email with instructions on how to reset your password.',
|
||||
checkEmailForResetLink: 'Please check your email for a link to reset your password. If it doesn\'t appear within a few minutes, make sure to check your spam folder.',
|
||||
passwordChanged: 'Sign in now',
|
||||
changePassword: 'Change Password',
|
||||
changePassword: 'Set a password',
|
||||
changePasswordTip: 'Please enter a new password for your account',
|
||||
changePasswordBtn: 'Set a password',
|
||||
invalidToken: 'Invalid or expired token',
|
||||
confirmPassword: 'Confirm Password',
|
||||
confirmPasswordPlaceholder: 'Confirm your new password',
|
||||
|
|
|
@ -47,8 +47,9 @@ const translation = {
|
|||
forgotPasswordDesc: '请输入您的电子邮件地址以重置密码。我们将向您发送一封电子邮件,包含如何重置密码的说明。',
|
||||
checkEmailForResetLink: '请检查您的电子邮件以获取重置密码的链接。如果几分钟内没有收到,请检查您的垃圾邮件文件夹。',
|
||||
passwordChanged: '立即登录',
|
||||
changePassword: '更改密码',
|
||||
changePassword: '设置密码',
|
||||
changePasswordTip: '请输入您的新密码',
|
||||
changePasswordBtn: '设置密码',
|
||||
invalidToken: '无效或已过期的令牌',
|
||||
confirmPassword: '确认密码',
|
||||
confirmPasswordPlaceholder: '确认您的新密码',
|
||||
|
|
|
@ -330,7 +330,7 @@ export const sendEMailLoginCode = (email: string, language = 'en-US') =>
|
|||
post<CommonResponse & { data: string }>('/email-code-login', { body: { email, language } })
|
||||
|
||||
export const emailLoginWithCode = (data: { email: string;code: string;token: string }) =>
|
||||
post<CommonResponse & { data: string }>('/email-code-login/validity', { body: data })
|
||||
post<LoginResponse>('/email-code-login/validity', { body: data })
|
||||
|
||||
export const sendResetPasswordCode = (email: string, language = 'en-US') =>
|
||||
post<CommonResponse & { data: string }>('/forgot-password', { body: { email, language } })
|
||||
|
|
Loading…
Reference in New Issue
Block a user