Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/social login #3890

Merged
merged 5 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/components/Dialogs/SetPasswordDialog/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useFormik } from 'formik'
import gql from 'graphql-tag'
import _pickBy from 'lodash/pickBy'
import React, { useContext, useEffect, useState } from 'react'
import React, { useContext } from 'react'
import { FormattedMessage, useIntl } from 'react-intl'

import { KEYVALUE } from '~/common/enums'
Expand Down Expand Up @@ -48,7 +48,6 @@ const SetPasswordDialogContent: React.FC<FormProps> = ({ closeDialog }) => {
const [set] = useMutation<SetPasswordMutation>(SET_PASSWORD, undefined, {
showToast: false,
})
const [inputType, setInputType] = useState<'password' | 'text'>('password')

const { lang } = useContext(LanguageContext)

Expand Down Expand Up @@ -99,15 +98,10 @@ const SetPasswordDialogContent: React.FC<FormProps> = ({ closeDialog }) => {
},
})

useEffect(() => {
// Switch back to plaintext display
setInputType('text')
}, [])

const InnerForm = (
<Form id={formId} onSubmit={handleSubmit}>
<Form.Input
type={inputType}
type="text"
name="password"
autoFocus
required
Expand Down
4 changes: 2 additions & 2 deletions src/components/Forms/PaymentForm/PayTo/Confirm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ const Confirm: React.FC<FormProps> = ({
<>
<p className={styles.hint}>
<Translate
zh_hant="输入六位數字交易密碼即可完成:"
zh_hans="輸入六位数字交易密码即可完成:"
zh_hant="輸入六位數字交易密碼即可完成:"
zh_hans="输入六位数字交易密码即可完成:"
en="Please Enter a 6-digit payment password"
/>
</p>
Expand Down
15 changes: 12 additions & 3 deletions src/components/GlobalDialogs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import { useContext, useEffect } from 'react'

import { OPEN_SET_USER_NAME_DIALOG } from '~/common/enums'
import { LikeCoinDialog, SetUserNameDialog, ViewerContext } from '~/components'
import {
LikeCoinDialog,
SetUserNameDialog,
useRoute,
ViewerContext,
} from '~/components'

import UniversalAuthDialog from './UniversalAuthDialog'

const GlobalDialogs = () => {
const viewer = useContext(ViewerContext)
const { router, isInPath } = useRoute()

useEffect(() => {
if (!viewer.isAuthed) {
return
}

if (!viewer.userName || viewer.info.userNameEditable) {
if (
(!viewer.userName || viewer.info.userNameEditable) &&
!isInPath('CALLBACK_PROVIDER')
) {
window.dispatchEvent(new CustomEvent(OPEN_SET_USER_NAME_DIALOG))
}
}, [])
}, [router.pathname])

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/views/Me/Settings/Account/Socials/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useLayoutEffect, useState } from 'react'
import { useContext, useEffect, useState } from 'react'
import { FormattedMessage } from 'react-intl'

import {
Expand Down Expand Up @@ -69,7 +69,7 @@ const Socials = () => {
router.push(url)
}

useLayoutEffect(() => {
useEffect(() => {
const bindResult = storage.remove(OAUTH_STORAGE_BIND_STATE)
if (!bindResult) {
return
Expand Down
Loading