Skip to content

Commit c48ce1e

Browse files
authored
Merge pull request #3013 from rahulrana701/new-password-error
error added that the new password entered should be different from the current password
2 parents 8f4b9fd + e2d4ea8 commit c48ce1e

17 files changed

+24
-4
lines changed

Diff for: client/utils/reduxFormUtils.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export const domOnlyProps = ({
1313
visited,
1414
autofilled,
1515
error,
16-
...domProps }) => domProps;
16+
...domProps
17+
}) => domProps;
1718
/* eslint-enable */
1819

1920
/* eslint-disable */
20-
const EMAIL_REGEX =
21-
/^(([^<>()[\]\\.,;:\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;
21+
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;
2222
/* eslint-enable */
2323

2424
function validateNameEmail(formProps, errors) {
@@ -51,6 +51,9 @@ export function validateSettings(formProps) {
5151
if (formProps.newPassword && formProps.newPassword.length < 6) {
5252
errors.newPassword = i18n.t('ReduxFormUtils.errorShortPassword');
5353
}
54+
if (formProps.currentPassword === formProps.newPassword) {
55+
errors.newPassword = i18n.t('ReduxFormUtils.errorNewPasswordRepeat');
56+
}
5457
return errors;
5558
}
5659

Diff for: translations/locales/be/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@
287287
"errorShortPassword": "পাসওয়ার্ডটি কমপক্ষে 6 টি অক্ষর হতে হবে",
288288
"errorConfirmPassword": "আপনার পাসওয়ার্ড নিশ্চিত করুন",
289289
"errorNewPassword": "দয়া করে একটি নতুন পাসওয়ার্ড লিখুন বা বর্তমান পাসওয়ার্ডটি ফাঁকা রাখুন।",
290+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
290291
"errorEmptyUsername": "দয়া করে একটি ইউজারনেম লিখুন",
291292
"errorLongUsername": "ইউজারনেম সর্বাধিক 20 অক্ষর হতে হবে",
292293
"errorValidUsername": "ইউজারনেম কেবলমাত্র সংখ্যা, অক্ষর, দোতলা, ড্যাশ, এবং আন্ডারস্কোর থাকতে পারে"

Diff for: translations/locales/de/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@
280280
"errorEmptyPassword": "Gib bitte ein Passwort ein",
281281
"errorShortPassword": "Das Passwort muss mindestens aus 6 Zeichen bestehen",
282282
"errorConfirmPassword": "Gib bitte das Passwort erneut ein",
283+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
283284
"errorNewPassword": "Gib bitte ein neues Passwort ein oder lass dieses Feld frei.",
284285
"errorEmptyUsername": "Gib bitte einen Nutzernamen ein.",
285286
"errorLongUsername": "Der Nutzername muss weniger als 20 Zeichen haben.",

Diff for: translations/locales/en-US/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
"errorShortPassword": "Password must be at least 6 characters",
293293
"errorConfirmPassword": "Please confirm your password",
294294
"errorNewPassword": "Please enter a new password or leave the current password empty.",
295+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
295296
"errorEmptyUsername": "Please enter a username.",
296297
"errorLongUsername": "Username must be less than 20 characters.",
297298
"errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores."

Diff for: translations/locales/es-419/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
"errorShortPassword": "La contraseña debe tener al menos 6 caracteres",
282282
"errorConfirmPassword": "Por favor confirma una contraseña",
283283
"errorNewPassword": "Por favor introduce una nueva contraseña o deja la actual contraseña vacía",
284+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
284285
"errorEmptyUsername": "Por favor introduce tu identificación",
285286
"errorLongUsername": "La identificación debe ser menor a 20 caracteres.",
286287
"errorValidUsername": "La identificación debe consistir solamente de números, letras, puntos, guiones y guiones bajos."

Diff for: translations/locales/fr-CA/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
"errorEmptyPassword": "Veuillez saisir un mot de passe",
284284
"errorShortPassword": "Le mot de passe doit comporter au moins 6 caractères",
285285
"errorConfirmPassword": "Veuillez saisir une confirmation de mot de passe",
286+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
286287
"errorNewPassword": "Veuillez saisir un nouveau mot de passe ou laisser le mot de passe actuel vide.",
287288
"errorEmptyUsername": "Veuillez saisir un nom d'utilisateur.",
288289
"errorLongUsername": "Le nom d'utilisateur doit comporter moins de 20 caractères.",

Diff for: translations/locales/hi/translations.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@
294294
"errorNewPassword": "कृपया एक नया पासवर्ड दर्ज करें या वर्तमान पासवर्ड को खाली छोड़ दें।",
295295
"errorEmptyUsername": "कृपया यूजरनेम लिखें",
296296
"errorLongUsername": "यूजरनेम २० अक्षरों से कम होना चाहिए।",
297-
"errorValidUsername": "यूजरनेम में केवल संख्या, अक्षर, पिरीअड्, डैश और अंडरस्कोर शामिल होना चाहिए।"
297+
"errorValidUsername": "यूजरनेम में केवल संख्या, अक्षर, पिरीअड्, डैश और अंडरस्कोर शामिल होना चाहिए।",
298+
"errorNewPasswordRepeat":"नया पासवर्ड वर्तमान पासवर्ड से भिन्न होना चाहिए।."
299+
298300
},
299301
"NewPasswordView": {
300302
"Title": "p5.js वेब एडिटर | नया पासवर्ड",

Diff for: translations/locales/it/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
"errorShortPassword": "La password dev'essere di almeno 6 caratteri",
285285
"errorConfirmPassword": "Per favore inserisci la password di conferma",
286286
"errorNewPassword": "Per favore inserisci una nuova password o lascia la password corrente vuota.",
287+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
287288
"errorEmptyUsername": "Per favore inserisci un nome utente.",
288289
"errorLongUsername": "Il nome utente deve avere meno di 20 caratteri.",
289290
"errorValidUsername": "Il nome utente dev'essere composto solo da numeri, lettere, must only consist of numbers, letters, punti, trattini e trattini bassi."

Diff for: translations/locales/ja/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
"errorShortPassword": "パスワードは6文字以上にしてください",
282282
"errorConfirmPassword": "確認用のパスワードを入力してください",
283283
"errorNewPassword": "新しいパスワードを入力するか、現在のパスワードを空欄のままにしてください。",
284+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
284285
"errorEmptyUsername": "ユーザー名を入力してください。",
285286
"errorLongUsername": "ユーザー名は20文字以内にしてください。",
286287
"errorValidUsername": "ユーザー名は、英数字、ピリオド(.)、ダッシュ(-)、アンダースコア(_)のみで構成されている必要があります。"

Diff for: translations/locales/ko/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@
269269
"errorShortPassword": "Password must be at least 6 characters",
270270
"errorConfirmPassword": "Please confirm your password",
271271
"errorNewPassword": "Please enter a new password or leave the current password empty.",
272+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
272273
"errorEmptyUsername": "Please enter a username.",
273274
"errorLongUsername": "Username must be less than 20 characters.",
274275
"errorValidUsername": "Username must only consist of numbers, letters, periods, dashes, and underscores."

Diff for: translations/locales/pt-BR/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
"errorShortPassword": "Senha deve ter no mínimo 6 caracteres",
282282
"errorConfirmPassword": "Por favor coloque a senha de confirmação",
283283
"errorNewPassword": "Por favor, adicione uma senha nova ou deixe a atual em branco.",
284+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
284285
"errorEmptyUsername": "Por favor coloque um nome de usuário",
285286
"errorLongUsername": "Nome de usuário deve ter menos de 20 caracteres.",
286287
"errorValidUsername": "Nome de usuário pode apenas consistir de números, letras, pontos, Hífens e linha sublinhada."

Diff for: translations/locales/sv/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
"errorShortPassword": "Lösenordet måste vara minst 6 tecken",
282282
"errorConfirmPassword": "Ange en lösenordsbekräftelse",
283283
"errorNewPassword": "Ange ett nytt lösenord eller lämna det nuvarande lösenordet tomt.",
284+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
284285
"errorEmptyUsername": "Ange ett användarnamn.",
285286
"errorLongUsername": "Användarnamnet får innehålla högst 19 tecken.",
286287
"errorValidUsername": "Användarnamnet får bara innehålla siffror, bokstäver, punkter, bindestreck och understreck."

Diff for: translations/locales/tr/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
"errorShortPassword": "Şifre en az 6 karakter olmalıdır",
285285
"errorConfirmPassword": "Lütfen şifrenizi doğrulayın",
286286
"errorNewPassword": "Lütfen yeni bir şifre girin veya mevcut şifreyi boş bırakın.",
287+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
287288
"errorEmptyUsername": "Lütfen bir kullanıcı adı girin.",
288289
"errorLongUsername": "Kullanıcı adı 20 karakterden az olmalıdır.",
289290
"errorValidUsername": "Kullanıcı adı sadece sayılar, harfler, noktalar, tireler ve alt çizgilerden oluşmalıdır."

Diff for: translations/locales/uk-UA/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
"errorShortPassword": "Пароль повинен містити щонайменше 6 символів",
284284
"errorConfirmPassword": "Введіть підтвердження пароля",
285285
"errorNewPassword": "Введіть новий пароль або залиште поточний пароль порожнім.",
286+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
286287
"errorEmptyUsername": "Введіть ім'я користувача.",
287288
"errorLongUsername": "Ім'я користувача має містити менше 20 символів.",
288289
"errorValidUsername": "Ім'я користувача має складатися лише з цифр, літер, крапок, тире та символа підкреслення."

Diff for: translations/locales/ur/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@
282282
"errorShortPassword": "پاس ورڈ کم از کم 6 حروف کا ہونا چاہیے۔",
283283
"errorConfirmPassword": "براہ کرم اپنے پاس ورڈ کی تصدیق کریں۔",
284284
"errorNewPassword": "براہ کرم نیا پاس ورڈ درج کریں یا موجودہ پاس ورڈ کو خالی چھوڑ دیں۔",
285+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
285286
"errorEmptyUsername": "براہ کرم ایک صارف نام درج کریں۔",
286287
"errorLongUsername": "صارف کا نام 20 حروف سے کم ہونا چاہیے۔",
287288
"errorValidUsername": "صارف کا نام صرف نمبرز، حروف، پیریڈز، ڈیشز اور انڈر سکور پر مشتمل ہونا چاہیے۔"

Diff for: translations/locales/zh-CN/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
"errorShortPassword": "密码至少六位",
285285
"errorConfirmPassword": "请再次输入密码以确认",
286286
"errorNewPassword": "请输入一个新密码或保持当前密码为空",
287+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
287288
"errorEmptyUsername": "请输入一个用户名",
288289
"errorLongUsername": "用户名至多20位",
289290
"errorValidUsername": "用户名只能含有数字,字母,和某些标点符号(. - _)。"

Diff for: translations/locales/zh-TW/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
"errorShortPassword": "密碼至少要有 6 個字元",
285285
"errorConfirmPassword": "請再輸入一次密碼確認正確性",
286286
"errorNewPassword": "請輸入新密碼或讓目前密碼欄位留空",
287+
"errorNewPasswordRepeat":"Your New Password must differ from the current one.",
287288
"errorEmptyUsername": "請輸入使用者名稱",
288289
"errorLongUsername": "使用者名稱最多只能 20 個字元",
289290
"errorValidUsername": "使用者名稱只能有數字、字母、英文句點、減號以及底線符號"

0 commit comments

Comments
 (0)