Skip to content

Commit

Permalink
Merge pull request #3890 from thematters/fix/social-login
Browse files Browse the repository at this point in the history
Fix/social login
  • Loading branch information
wlliaml authored Oct 13, 2023
2 parents 55b8d9f + c837933 commit fa40d8a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
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

1 comment on commit fa40d8a

@vercel
Copy link

@vercel vercel bot commented on fa40d8a Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.