From 0a18d25db82c5b49fda6dfffebb3d3d967905585 Mon Sep 17 00:00:00 2001 From: rahulrana701 Date: Sun, 11 Feb 2024 13:30:19 +0530 Subject: [PATCH 1/3] error added that the new password should be different from the current password --- client/utils/reduxFormUtils.js | 9 ++++++--- translations/locales/en-US/translations.json | 3 ++- translations/locales/hi/translations.json | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/utils/reduxFormUtils.js b/client/utils/reduxFormUtils.js index 83ea15e402..e6a34a92b5 100644 --- a/client/utils/reduxFormUtils.js +++ b/client/utils/reduxFormUtils.js @@ -13,12 +13,12 @@ export const domOnlyProps = ({ visited, autofilled, error, - ...domProps }) => domProps; + ...domProps +}) => domProps; /* eslint-enable */ /* eslint-disable */ -const EMAIL_REGEX = - /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i; +const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i; /* eslint-enable */ function validateNameEmail(formProps, errors) { @@ -51,6 +51,9 @@ export function validateSettings(formProps) { if (formProps.newPassword && formProps.newPassword.length < 6) { errors.newPassword = i18n.t('ReduxFormUtils.errorShortPassword'); } + if (formProps.currentPassword === formProps.newPassword) { + errors.newPassword = i18n.t('ReduxFormUtils.errorNewPasswordNotCorrect'); + } return errors; } diff --git a/translations/locales/en-US/translations.json b/translations/locales/en-US/translations.json index 39f3a426ef..6089a03df7 100644 --- a/translations/locales/en-US/translations.json +++ b/translations/locales/en-US/translations.json @@ -289,7 +289,8 @@ "errorNewPassword": "Please enter a new password or leave the current password empty.", "errorEmptyUsername": "Please enter a username.", "errorLongUsername": "Username must be less than 20 characters.", - "errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores." + "errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores.", + "errorNewPasswordNotCorrect":"New Password entered should be different from Current Password ." }, "NewPasswordView": { "Title": "p5.js Web Editor | New Password", diff --git a/translations/locales/hi/translations.json b/translations/locales/hi/translations.json index 4226725a98..3a6816a8fd 100644 --- a/translations/locales/hi/translations.json +++ b/translations/locales/hi/translations.json @@ -290,7 +290,9 @@ "errorNewPassword": "कृपया एक नया पासवर्ड दर्ज करें या वर्तमान पासवर्ड को खाली छोड़ दें।", "errorEmptyUsername": "कृपया यूजरनेम लिखें", "errorLongUsername": "यूजरनेम २० अक्षरों से कम होना चाहिए।", - "errorValidUsername": "यूजरनेम में केवल संख्या, अक्षर, पिरीअड्, डैश और अंडरस्कोर शामिल होना चाहिए।" + "errorValidUsername": "यूजरनेम में केवल संख्या, अक्षर, पिरीअड्, डैश और अंडरस्कोर शामिल होना चाहिए।", + "errorNewPasswordNotCorrect":"नया पासवर्ड वर्तमान पासवर्ड से भिन्न होना चाहिए।." + }, "NewPasswordView": { "Title": "p5.js वेब एडिटर | नया पासवर्ड", From b946fd0c8472dc037b1c2c64e292da677d48e5ce Mon Sep 17 00:00:00 2001 From: raclim Date: Thu, 13 Jun 2024 13:49:59 -0400 Subject: [PATCH 2/3] update translations --- client/utils/reduxFormUtils.js | 2 +- translations/locales/be/translations.json | 3 ++- translations/locales/de/translations.json | 1 + translations/locales/en-US/translations.json | 4 ++-- translations/locales/es-419/translations.json | 1 + translations/locales/fr-CA/translations.json | 1 + translations/locales/hi/translations.json | 2 +- translations/locales/it/translations.json | 1 + translations/locales/ja/translations.json | 1 + translations/locales/ko/translations.json | 1 + translations/locales/pt-BR/translations.json | 1 + translations/locales/sv/translations.json | 1 + translations/locales/tr/translations.json | 1 + translations/locales/uk-UA/translations.json | 1 + translations/locales/ur/translations.json | 1 + translations/locales/zh-CN/translations.json | 1 + translations/locales/zh-TW/translations.json | 1 + 17 files changed, 19 insertions(+), 5 deletions(-) diff --git a/client/utils/reduxFormUtils.js b/client/utils/reduxFormUtils.js index e6a34a92b5..94962fbc71 100644 --- a/client/utils/reduxFormUtils.js +++ b/client/utils/reduxFormUtils.js @@ -52,7 +52,7 @@ export function validateSettings(formProps) { errors.newPassword = i18n.t('ReduxFormUtils.errorShortPassword'); } if (formProps.currentPassword === formProps.newPassword) { - errors.newPassword = i18n.t('ReduxFormUtils.errorNewPasswordNotCorrect'); + errors.newPassword = i18n.t('ReduxFormUtils.errorNewPasswordRepeat'); } return errors; } diff --git a/translations/locales/be/translations.json b/translations/locales/be/translations.json index 5e34d38ef5..51dc807259 100644 --- a/translations/locales/be/translations.json +++ b/translations/locales/be/translations.json @@ -287,9 +287,10 @@ "errorShortPassword": "পাসওয়ার্ডটি কমপক্ষে 6 টি অক্ষর হতে হবে", "errorConfirmPassword": "আপনার পাসওয়ার্ড নিশ্চিত করুন", "errorNewPassword": "দয়া করে একটি নতুন পাসওয়ার্ড লিখুন বা বর্তমান পাসওয়ার্ডটি ফাঁকা রাখুন।", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "দয়া করে একটি ইউজারনেম লিখুন", "errorLongUsername": "ইউজারনেম সর্বাধিক 20 অক্ষর হতে হবে", - "errorValidUsername": "ইউজারনেম কেবলমাত্র সংখ্যা, অক্ষর, দোতলা, ড্যাশ, এবং আন্ডারস্কোর থাকতে পারে" + "errorValidUsername": "ইউজারনেম কেবলমাত্র সংখ্যা, অক্ষর, দোতলা, ড্যাশ, এবং আন্ডারস্কোর থাকতে পারে", }, "NewPasswordView": { "Title": "p5.js ওয়েব এডিটর | নতুন পাসওয়ার্ড", diff --git a/translations/locales/de/translations.json b/translations/locales/de/translations.json index 3af09022a8..c9998dea0b 100644 --- a/translations/locales/de/translations.json +++ b/translations/locales/de/translations.json @@ -280,6 +280,7 @@ "errorEmptyPassword": "Gib bitte ein Passwort ein", "errorShortPassword": "Das Passwort muss mindestens aus 6 Zeichen bestehen", "errorConfirmPassword": "Gib bitte das Passwort erneut ein", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorNewPassword": "Gib bitte ein neues Passwort ein oder lass dieses Feld frei.", "errorEmptyUsername": "Gib bitte einen Nutzernamen ein.", "errorLongUsername": "Der Nutzername muss weniger als 20 Zeichen haben.", diff --git a/translations/locales/en-US/translations.json b/translations/locales/en-US/translations.json index f1630ac9f8..32eeabd57a 100644 --- a/translations/locales/en-US/translations.json +++ b/translations/locales/en-US/translations.json @@ -292,10 +292,10 @@ "errorShortPassword": "Password must be at least 6 characters", "errorConfirmPassword": "Please confirm your password", "errorNewPassword": "Please enter a new password or leave the current password empty.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Please enter a username.", "errorLongUsername": "Username must be less than 20 characters.", - "errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores.", - "errorNewPasswordNotCorrect":"New Password entered should be different from Current Password ." + "errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores." }, "NewPasswordView": { "Title": "p5.js Web Editor | New Password", diff --git a/translations/locales/es-419/translations.json b/translations/locales/es-419/translations.json index b8993276d7..1336cf47d2 100644 --- a/translations/locales/es-419/translations.json +++ b/translations/locales/es-419/translations.json @@ -281,6 +281,7 @@ "errorShortPassword": "La contraseña debe tener al menos 6 caracteres", "errorConfirmPassword": "Por favor confirma una contraseña", "errorNewPassword": "Por favor introduce una nueva contraseña o deja la actual contraseña vacía", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Por favor introduce tu identificación", "errorLongUsername": "La identificación debe ser menor a 20 caracteres.", "errorValidUsername": "La identificación debe consistir solamente de números, letras, puntos, guiones y guiones bajos." diff --git a/translations/locales/fr-CA/translations.json b/translations/locales/fr-CA/translations.json index 89d5e0c6c9..15a19ede8a 100644 --- a/translations/locales/fr-CA/translations.json +++ b/translations/locales/fr-CA/translations.json @@ -283,6 +283,7 @@ "errorEmptyPassword": "Veuillez saisir un mot de passe", "errorShortPassword": "Le mot de passe doit comporter au moins 6 caractères", "errorConfirmPassword": "Veuillez saisir une confirmation de mot de passe", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorNewPassword": "Veuillez saisir un nouveau mot de passe ou laisser le mot de passe actuel vide.", "errorEmptyUsername": "Veuillez saisir un nom d'utilisateur.", "errorLongUsername": "Le nom d'utilisateur doit comporter moins de 20 caractères.", diff --git a/translations/locales/hi/translations.json b/translations/locales/hi/translations.json index bf0b6b64d1..b05e296a6c 100644 --- a/translations/locales/hi/translations.json +++ b/translations/locales/hi/translations.json @@ -295,7 +295,7 @@ "errorEmptyUsername": "कृपया यूजरनेम लिखें", "errorLongUsername": "यूजरनेम २० अक्षरों से कम होना चाहिए।", "errorValidUsername": "यूजरनेम में केवल संख्या, अक्षर, पिरीअड्, डैश और अंडरस्कोर शामिल होना चाहिए।", - "errorNewPasswordNotCorrect":"नया पासवर्ड वर्तमान पासवर्ड से भिन्न होना चाहिए।." + "errorNewPasswordRepeat":"नया पासवर्ड वर्तमान पासवर्ड से भिन्न होना चाहिए।." }, "NewPasswordView": { diff --git a/translations/locales/it/translations.json b/translations/locales/it/translations.json index 54eeaeca8d..b28f0f835e 100644 --- a/translations/locales/it/translations.json +++ b/translations/locales/it/translations.json @@ -284,6 +284,7 @@ "errorShortPassword": "La password dev'essere di almeno 6 caratteri", "errorConfirmPassword": "Per favore inserisci la password di conferma", "errorNewPassword": "Per favore inserisci una nuova password o lascia la password corrente vuota.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Per favore inserisci un nome utente.", "errorLongUsername": "Il nome utente deve avere meno di 20 caratteri.", "errorValidUsername": "Il nome utente dev'essere composto solo da numeri, lettere, must only consist of numbers, letters, punti, trattini e trattini bassi." diff --git a/translations/locales/ja/translations.json b/translations/locales/ja/translations.json index 04ea7e5ce3..ba073a78f0 100644 --- a/translations/locales/ja/translations.json +++ b/translations/locales/ja/translations.json @@ -281,6 +281,7 @@ "errorShortPassword": "パスワードは6文字以上にしてください", "errorConfirmPassword": "確認用のパスワードを入力してください", "errorNewPassword": "新しいパスワードを入力するか、現在のパスワードを空欄のままにしてください。", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "ユーザー名を入力してください。", "errorLongUsername": "ユーザー名は20文字以内にしてください。", "errorValidUsername": "ユーザー名は、英数字、ピリオド(.)、ダッシュ(-)、アンダースコア(_)のみで構成されている必要があります。" diff --git a/translations/locales/ko/translations.json b/translations/locales/ko/translations.json index b1fe4c88d5..1f805f20bc 100644 --- a/translations/locales/ko/translations.json +++ b/translations/locales/ko/translations.json @@ -269,6 +269,7 @@ "errorShortPassword": "Password must be at least 6 characters", "errorConfirmPassword": "Please confirm your password", "errorNewPassword": "Please enter a new password or leave the current password empty.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Please enter a username.", "errorLongUsername": "Username must be less than 20 characters.", "errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores." diff --git a/translations/locales/pt-BR/translations.json b/translations/locales/pt-BR/translations.json index d5b4515c06..f11255f269 100644 --- a/translations/locales/pt-BR/translations.json +++ b/translations/locales/pt-BR/translations.json @@ -281,6 +281,7 @@ "errorShortPassword": "Senha deve ter no mínimo 6 caracteres", "errorConfirmPassword": "Por favor coloque a senha de confirmação", "errorNewPassword": "Por favor, adicione uma senha nova ou deixe a atual em branco.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Por favor coloque um nome de usuário", "errorLongUsername": "Nome de usuário deve ter menos de 20 caracteres.", "errorValidUsername": "Nome de usuário pode apenas consistir de números, letras, pontos, Hífens e linha sublinhada." diff --git a/translations/locales/sv/translations.json b/translations/locales/sv/translations.json index d03c3d6522..8fa743507a 100644 --- a/translations/locales/sv/translations.json +++ b/translations/locales/sv/translations.json @@ -281,6 +281,7 @@ "errorShortPassword": "Lösenordet måste vara minst 6 tecken", "errorConfirmPassword": "Ange en lösenordsbekräftelse", "errorNewPassword": "Ange ett nytt lösenord eller lämna det nuvarande lösenordet tomt.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Ange ett användarnamn.", "errorLongUsername": "Användarnamnet får innehålla högst 19 tecken.", "errorValidUsername": "Användarnamnet får bara innehålla siffror, bokstäver, punkter, bindestreck och understreck." diff --git a/translations/locales/tr/translations.json b/translations/locales/tr/translations.json index f846cc9072..290f0c2473 100644 --- a/translations/locales/tr/translations.json +++ b/translations/locales/tr/translations.json @@ -284,6 +284,7 @@ "errorShortPassword": "Şifre en az 6 karakter olmalıdır", "errorConfirmPassword": "Lütfen şifrenizi doğrulayın", "errorNewPassword": "Lütfen yeni bir şifre girin veya mevcut şifreyi boş bırakın.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Lütfen bir kullanıcı adı girin.", "errorLongUsername": "Kullanıcı adı 20 karakterden az olmalıdır.", "errorValidUsername": "Kullanıcı adı sadece sayılar, harfler, noktalar, tireler ve alt çizgilerden oluşmalıdır." diff --git a/translations/locales/uk-UA/translations.json b/translations/locales/uk-UA/translations.json index 56922c356c..8c79ff28e6 100644 --- a/translations/locales/uk-UA/translations.json +++ b/translations/locales/uk-UA/translations.json @@ -283,6 +283,7 @@ "errorShortPassword": "Пароль повинен містити щонайменше 6 символів", "errorConfirmPassword": "Введіть підтвердження пароля", "errorNewPassword": "Введіть новий пароль або залиште поточний пароль порожнім.", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "Введіть ім'я користувача.", "errorLongUsername": "Ім'я користувача має містити менше 20 символів.", "errorValidUsername": "Ім'я користувача має складатися лише з цифр, літер, крапок, тире та символа підкреслення." diff --git a/translations/locales/ur/translations.json b/translations/locales/ur/translations.json index 07d79eef4d..87cdd17e59 100644 --- a/translations/locales/ur/translations.json +++ b/translations/locales/ur/translations.json @@ -282,6 +282,7 @@ "errorShortPassword": "پاس ورڈ کم از کم 6 حروف کا ہونا چاہیے۔", "errorConfirmPassword": "براہ کرم اپنے پاس ورڈ کی تصدیق کریں۔", "errorNewPassword": "براہ کرم نیا پاس ورڈ درج کریں یا موجودہ پاس ورڈ کو خالی چھوڑ دیں۔", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "براہ کرم ایک صارف نام درج کریں۔", "errorLongUsername": "صارف کا نام 20 حروف سے کم ہونا چاہیے۔", "errorValidUsername": "صارف کا نام صرف نمبرز، حروف، پیریڈز، ڈیشز اور انڈر سکور پر مشتمل ہونا چاہیے۔" diff --git a/translations/locales/zh-CN/translations.json b/translations/locales/zh-CN/translations.json index 5c84680e65..1e3ef7e4c4 100644 --- a/translations/locales/zh-CN/translations.json +++ b/translations/locales/zh-CN/translations.json @@ -284,6 +284,7 @@ "errorShortPassword": "密码至少六位", "errorConfirmPassword": "请再次输入密码以确认", "errorNewPassword": "请输入一个新密码或保持当前密码为空", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "请输入一个用户名", "errorLongUsername": "用户名至多20位", "errorValidUsername": "用户名只能含有数字,字母,和某些标点符号(. - _)。" diff --git a/translations/locales/zh-TW/translations.json b/translations/locales/zh-TW/translations.json index 206e134911..94e9570019 100644 --- a/translations/locales/zh-TW/translations.json +++ b/translations/locales/zh-TW/translations.json @@ -284,6 +284,7 @@ "errorShortPassword": "密碼至少要有 6 個字元", "errorConfirmPassword": "請再輸入一次密碼確認正確性", "errorNewPassword": "請輸入新密碼或讓目前密碼欄位留空", + "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "請輸入使用者名稱", "errorLongUsername": "使用者名稱最多只能 20 個字元", "errorValidUsername": "使用者名稱只能有數字、字母、英文句點、減號以及底線符號" From e2d4ea8f51a4e8692a14862c4562ec34f5f7f606 Mon Sep 17 00:00:00 2001 From: raclim Date: Thu, 13 Jun 2024 13:53:19 -0400 Subject: [PATCH 3/3] remove typo --- translations/locales/be/translations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/locales/be/translations.json b/translations/locales/be/translations.json index 51dc807259..e730032fbc 100644 --- a/translations/locales/be/translations.json +++ b/translations/locales/be/translations.json @@ -290,7 +290,7 @@ "errorNewPasswordRepeat":"Your New Password must differ from the current one.", "errorEmptyUsername": "দয়া করে একটি ইউজারনেম লিখুন", "errorLongUsername": "ইউজারনেম সর্বাধিক 20 অক্ষর হতে হবে", - "errorValidUsername": "ইউজারনেম কেবলমাত্র সংখ্যা, অক্ষর, দোতলা, ড্যাশ, এবং আন্ডারস্কোর থাকতে পারে", + "errorValidUsername": "ইউজারনেম কেবলমাত্র সংখ্যা, অক্ষর, দোতলা, ড্যাশ, এবং আন্ডারস্কোর থাকতে পারে" }, "NewPasswordView": { "Title": "p5.js ওয়েব এডিটর | নতুন পাসওয়ার্ড",