Skip to content

Commit

Permalink
feat(console): log in with third-party account (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
jialeicui authored Aug 16, 2022
1 parent 368ea4d commit f5acd1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions console/src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export const dateTimeFormat = 'YYYY-MM-DD HH:mm:ss'
export const drawerExpandedWidthOfColumnManage = 520
export const passwordMinLength = 8
export const SignupNeedCreateAccount = 'account_not_created'
export const SignupAccountCreated = 'account_created'
7 changes: 6 additions & 1 deletion console/src/pages/Home/LoginNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { Trans } from 'react-i18next'
import './login.scss'
import { useSearchParam } from 'react-use'
import ThirdPartyLoginButton from '@user/components/ThirdPartyLoginButton'
import { SignupNeedCreateAccount } from '@/consts'
import { SignupNeedCreateAccount, SignupAccountCreated } from '@/consts'
import { setToken } from '@/api'
import LoginLayout from './LoginLayout'

const { Form, FormItem } = createForm<ILoginUserSchema>()
Expand All @@ -28,11 +29,15 @@ export default function LoginNew() {
const history = useHistory()
const [isLoading, setIsLoading] = useState(false)
const step = useSearchParam('step')
const token = useSearchParam('token') ?? ''
if (step === SignupNeedCreateAccount) {
history.push({
pathname: '/create-account',
search: location.search,
})
} else if (step === SignupAccountCreated) {
setToken(token)
history.push('/')
}

const handleRedirect = useCallback(() => {
Expand Down

0 comments on commit f5acd1c

Please sign in to comment.