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(user): fix password copy of unverified email user #3831

Merged
merged 1 commit into from
Sep 20, 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
4 changes: 4 additions & 0 deletions lang/default.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"+51DoZ": {
"defaultMessage": "Please verify email first",
"description": "src/views/Me/Settings/Settings/Password/index.tsx"
},
"+63O1f": {
"defaultMessage": "Incorrect email or password",
"description": "USER_PASSWORD_INVALID"
Expand Down
4 changes: 4 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"+51DoZ": {
"defaultMessage": "Please verify email first",
"description": "src/views/Me/Settings/Settings/Password/index.tsx"
},
"+63O1f": {
"defaultMessage": "Incorrect email or password",
"description": "USER_PASSWORD_INVALID"
Expand Down
4 changes: 4 additions & 0 deletions lang/zh-Hans.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"+51DoZ": {
"defaultMessage": "请先验证邮箱",
"description": "src/views/Me/Settings/Settings/Password/index.tsx"
},
"+63O1f": {
"defaultMessage": "邮箱或密码错误",
"description": "USER_PASSWORD_INVALID"
Expand Down
4 changes: 4 additions & 0 deletions lang/zh-Hant.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"+51DoZ": {
"defaultMessage": "請先驗證郵箱",
"description": "src/views/Me/Settings/Settings/Password/index.tsx"
},
"+63O1f": {
"defaultMessage": "郵件地址或密碼錯誤",
"description": "USER_PASSWORD_INVALID"
Expand Down
18 changes: 14 additions & 4 deletions src/views/Me/Settings/Account/Password/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { SettingsButton } from '../../Button'

const Password = () => {
const viewer = useContext(ViewerContext)
const hasEmail = !!viewer.info.email && !!viewer.info.emailVerified
const hasEmail = !!viewer.info.email
const isEmailVerified = !!viewer.info.emailVerified
const hasPassword = !!viewer.status?.hasEmailLoginPassword

return (
Expand All @@ -23,7 +24,12 @@ const Password = () => {
}
rightText={
hasEmail ? (
hasPassword ? (
!isEmailVerified ? (
<FormattedMessage
defaultMessage="Please verify email first"
description="src/views/Me/Settings/Settings/Password/index.tsx"
/>
) : hasPassword ? (
<FormattedMessage defaultMessage="Change" />
) : undefined
) : (
Expand All @@ -34,9 +40,13 @@ const Password = () => {
)
}
rightTextColor={!hasEmail ? 'grey' : undefined}
onClick={hasEmail && hasPassword ? openDialog : undefined}
onClick={
hasEmail && isEmailVerified && !hasPassword
? openDialog
: undefined
}
right={
hasEmail && !hasPassword ? (
hasEmail && isEmailVerified && !hasPassword ? (
<SettingsButton onClick={openDialog}>
<FormattedMessage defaultMessage="Set" />
</SettingsButton>
Expand Down
Loading