Skip to content

Commit

Permalink
fix(user): fix password copy of unverified email user
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed Sep 20, 2023
1 parent c2f41e3 commit 51ccf39
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
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

0 comments on commit 51ccf39

Please sign in to comment.