mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
fix: web app login code encrypt (#30705)
This commit is contained in:
parent
c9858f851f
commit
4e0d3c224f
@ -14,6 +14,7 @@ import { useWebAppStore } from '@/context/web-app-context'
|
|||||||
import { sendWebAppEMailLoginCode, webAppEmailLoginWithCode } from '@/service/common'
|
import { sendWebAppEMailLoginCode, webAppEmailLoginWithCode } from '@/service/common'
|
||||||
import { fetchAccessToken } from '@/service/share'
|
import { fetchAccessToken } from '@/service/share'
|
||||||
import { setWebAppAccessToken, setWebAppPassport } from '@/service/webapp-auth'
|
import { setWebAppAccessToken, setWebAppPassport } from '@/service/webapp-auth'
|
||||||
|
import { encryptVerificationCode } from '@/utils/encryption'
|
||||||
|
|
||||||
export default function CheckCode() {
|
export default function CheckCode() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@ -64,7 +65,7 @@ export default function CheckCode() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const ret = await webAppEmailLoginWithCode({ email, code, token })
|
const ret = await webAppEmailLoginWithCode({ email, code: encryptVerificationCode(code), token })
|
||||||
if (ret.result === 'success') {
|
if (ret.result === 'success') {
|
||||||
setWebAppAccessToken(ret.data.access_token)
|
setWebAppAccessToken(ret.data.access_token)
|
||||||
const { access_token } = await fetchAccessToken({
|
const { access_token } = await fetchAccessToken({
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { useWebAppStore } from '@/context/web-app-context'
|
|||||||
import { webAppLogin } from '@/service/common'
|
import { webAppLogin } from '@/service/common'
|
||||||
import { fetchAccessToken } from '@/service/share'
|
import { fetchAccessToken } from '@/service/share'
|
||||||
import { setWebAppAccessToken, setWebAppPassport } from '@/service/webapp-auth'
|
import { setWebAppAccessToken, setWebAppPassport } from '@/service/webapp-auth'
|
||||||
|
import { encryptPassword } from '@/utils/encryption'
|
||||||
|
|
||||||
type MailAndPasswordAuthProps = {
|
type MailAndPasswordAuthProps = {
|
||||||
isEmailSetup: boolean
|
isEmailSetup: boolean
|
||||||
@ -72,7 +73,7 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut
|
|||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const loginData: Record<string, any> = {
|
const loginData: Record<string, any> = {
|
||||||
email,
|
email,
|
||||||
password,
|
password: encryptPassword(password),
|
||||||
language: locale,
|
language: locale,
|
||||||
remember_me: true,
|
remember_me: true,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user