From 51ccf3915bc307d3a8a21deebd3bff81bb7a600d Mon Sep 17 00:00:00 2001
From: robertu <4065233+robertu7@users.noreply.github.com>
Date: Wed, 20 Sep 2023 16:29:27 +0700
Subject: [PATCH] fix(user): fix password copy of unverified email user
---
lang/default.json | 4 ++++
lang/en.json | 4 ++++
lang/zh-Hans.json | 4 ++++
lang/zh-Hant.json | 4 ++++
.../Me/Settings/Account/Password/index.tsx | 18 ++++++++++++++----
5 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/lang/default.json b/lang/default.json
index b592c566c5..fb0f54ee44 100644
--- a/lang/default.json
+++ b/lang/default.json
@@ -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"
diff --git a/lang/en.json b/lang/en.json
index 419f7666b9..1fa257fa57 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -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"
diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json
index 03ba7c420a..c3c6da647d 100644
--- a/lang/zh-Hans.json
+++ b/lang/zh-Hans.json
@@ -1,4 +1,8 @@
{
+ "+51DoZ": {
+ "defaultMessage": "请先验证邮箱",
+ "description": "src/views/Me/Settings/Settings/Password/index.tsx"
+ },
"+63O1f": {
"defaultMessage": "邮箱或密码错误",
"description": "USER_PASSWORD_INVALID"
diff --git a/lang/zh-Hant.json b/lang/zh-Hant.json
index 1d8f73e159..75c9b22d65 100644
--- a/lang/zh-Hant.json
+++ b/lang/zh-Hant.json
@@ -1,4 +1,8 @@
{
+ "+51DoZ": {
+ "defaultMessage": "請先驗證郵箱",
+ "description": "src/views/Me/Settings/Settings/Password/index.tsx"
+ },
"+63O1f": {
"defaultMessage": "郵件地址或密碼錯誤",
"description": "USER_PASSWORD_INVALID"
diff --git a/src/views/Me/Settings/Account/Password/index.tsx b/src/views/Me/Settings/Account/Password/index.tsx
index 36ae16325f..6502b0a165 100644
--- a/src/views/Me/Settings/Account/Password/index.tsx
+++ b/src/views/Me/Settings/Account/Password/index.tsx
@@ -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 (
@@ -23,7 +24,12 @@ const Password = () => {
}
rightText={
hasEmail ? (
- hasPassword ? (
+ !isEmailVerified ? (
+
+ ) : hasPassword ? (
) : undefined
) : (
@@ -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 ? (