mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 23:20:12 -05:00
fix: redirect after login (#30985)
This commit is contained in:
@@ -66,7 +66,9 @@ export default function CheckCode() {
|
|||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const ret = await webAppEmailLoginWithCode({ email, code: encryptVerificationCode(code), token })
|
const ret = await webAppEmailLoginWithCode({ email, code: encryptVerificationCode(code), token })
|
||||||
if (ret.result === 'success') {
|
if (ret.result === 'success') {
|
||||||
setWebAppAccessToken(ret.data.access_token)
|
if (ret?.data?.access_token) {
|
||||||
|
setWebAppAccessToken(ret.data.access_token)
|
||||||
|
}
|
||||||
const { access_token } = await fetchAccessToken({
|
const { access_token } = await fetchAccessToken({
|
||||||
appCode: appCode!,
|
appCode: appCode!,
|
||||||
userId: embeddedUserId || undefined,
|
userId: embeddedUserId || undefined,
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut
|
|||||||
body: loginData,
|
body: loginData,
|
||||||
})
|
})
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
setWebAppAccessToken(res.data.access_token)
|
if (res?.data?.access_token) {
|
||||||
|
setWebAppAccessToken(res.data.access_token)
|
||||||
|
}
|
||||||
|
|
||||||
const { access_token } = await fetchAccessToken({
|
const { access_token } = await fetchAccessToken({
|
||||||
appCode: appCode!,
|
appCode: appCode!,
|
||||||
|
|||||||
@@ -65,8 +65,10 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegis
|
|||||||
body: loginData,
|
body: loginData,
|
||||||
})
|
})
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
// Track login success event
|
if (res?.data?.access_token) {
|
||||||
setWebAppAccessToken(res.data.access_token)
|
// Track login success event
|
||||||
|
setWebAppAccessToken(res.data.access_token)
|
||||||
|
}
|
||||||
trackEvent('user_login_success', {
|
trackEvent('user_login_success', {
|
||||||
method: 'email_password',
|
method: 'email_password',
|
||||||
is_invite: isInvite,
|
is_invite: isInvite,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import { del, get, patch, post, put } from './base'
|
|||||||
|
|
||||||
type LoginSuccess = {
|
type LoginSuccess = {
|
||||||
result: 'success'
|
result: 'success'
|
||||||
data: { access_token: string }
|
data?: { access_token?: string }
|
||||||
}
|
}
|
||||||
type LoginFail = {
|
type LoginFail = {
|
||||||
result: 'fail'
|
result: 'fail'
|
||||||
|
|||||||
Reference in New Issue
Block a user