Skip to content

Commit 5c46270

Browse files
authored
Merge pull request nerdapplabs#19 from aksinha-nerdapplabs/username_password_policy
Username/Password policy redesigned. Password change msg fixed.
2 parents 8220b78 + 99e8457 commit 5c46270

File tree

7 files changed

+38
-13
lines changed

7 files changed

+38
-13
lines changed

src/ApiBundle/Resources/config/validation.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ ApiBundle\Entity\User:
3232
api_error: 'api.show_error_username_policy'
3333
- Regex:
3434
groups: [Registration, Profile]
35-
pattern: '/^[a-z0-9_-]{3,16}$/'
35+
# Username should be 2-50 characters long with any Uppercase/lowercase letter (A-Za-z), number (0-9), any special character other than square brackets and quotes
36+
pattern: '/^[a-zA-Z0-9-_!@#$%&*+=()^{};:.,\\|\/?><]{2,50}$/'
3637
match: true
3738
message: "user.show_error_username_policy"
3839
payload:
@@ -57,8 +58,8 @@ ApiBundle\Entity\User:
5758
api_error: 'api.show_error_password_policy'
5859
- Regex:
5960
groups: [profile_edit_password, Registration, Profile]
60-
# Password 6-20 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character
61-
pattern: '/^(?=.*[a-z])(?=.*[A-Z])(?=.*[\d])(?=.*([^\w]))[A-Za-z\d$@$!%*?&]{6,20}$/'
61+
# Password 6-50 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character other than [ and ]
62+
pattern: '/(?=^.{6,50}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[-_!@#$%&*+=()^{};:.,\\|\/?><"'])(?!.*\s).*$/'
6263
match: true
6364
message: "user.show_error_password_policy"
6465
payload:
@@ -90,8 +91,8 @@ FOS\UserBundle\Form\Model\ChangePassword:
9091
payload:
9192
api_error: 'api.show_error_password_policy'
9293
- Regex:
93-
# Password 6-20 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character
94-
pattern: '/^(?=.*[a-z])(?=.*[A-Z])(?=.*[\d])(?=.*([^\w]))[A-Za-z\d$@$!%*?&]{6,20}$/'
94+
# Password 6-50 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character other than [ and ]
95+
pattern: '/(?=^.{6,50}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[-_!@#$%&*+=()^{};:.,\\|\/?><"'])(?!.*\s).*$/'
9596
match: true
9697
message: "user.show_error_password_policy"
9798
payload:

src/ApiBundle/Resources/translations/messages.en.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ flash:
129129
user_authentication_failed: User Authentication failed!
130130
image_error: Image Error!
131131
admin_deleted_denied1: Admin is not allowed to delete his own account!
132-
admin_deleted_denied2: There must be 1 active admin account, hence promote/assign another user to admin role before deleting this account.
132+
admin_deleted_denied2: There must be 1 active admin account, hence promote/assign another user to admin role before deleting this account.
133133
api:
134134
show_error_client_name: Sorry, Client Name cannot be empty!
135135
show_error_client_name_taken: Sorry, Client Name already taken!
@@ -165,3 +165,11 @@ api:
165165
mail_send: Mail already send to %email%. Please check your mail.
166166
logged_in: Logged in successfully!
167167
logged_out: Logged out successfully!
168+
# Password change
169+
change_password:
170+
flash:
171+
success: The password has been changed
172+
# Password resetting Te1!@#
173+
resetting:
174+
flash:
175+
success: The password has been reset successfully

src/ApiBundle/Resources/translations/messages.fr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,11 @@ api:
154154
mail_send: Le courrier est déjà envoyé à% email%. Veuillez vérifier votre e-mail.
155155
logged_in: Connecté avec succès!
156156
logged_out: Déconnecté avec succès!
157+
# Password change
158+
change_password:
159+
flash:
160+
success: Le mot de passe a été modifié
161+
# Password resetting
162+
resetting:
163+
flash:
164+
success: Le mot de passe a été réinitialisé avec succès

src/ApiBundle/Resources/translations/messages.hi.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ flash:
117117
user_authentication_failed: उपयोगकर्ता प्रमाणीकरण विफल रहा!
118118
image_error: छवि त्रुटि!
119119
admin_deleted_denied1: व्यवस्थापक अपने स्वयं के खाते को नष्ट करने की अनुमति नहीं है!
120-
admin_deleted_denied2: वहाँ 1 सक्रिय व्यवस्थापक खाता होना चाहिए, इसलिए बढ़ावा देने के / इस खाते को हटाने से पहले व्यवस्थापक भूमिका के लिए किसी अन्य उपयोगकर्ता आवंटित।
120+
admin_deleted_denied2: वहाँ 1 सक्रिय व्यवस्थापक खाता होना चाहिए, इसलिए बढ़ावा देने के / इस खाते को हटाने से पहले व्यवस्थापक भूमिका के लिए किसी अन्य उपयोगकर्ता आवंटित।
121121
api:
122122
show_error_client_name: क्षमा करें, क्लाइंट का नाम रिक्त नहीं हो सकता!
123123
show_error_client_name_taken: क्षमा करें, क्लाइंट का नाम पहले ही ले लिया!
@@ -154,3 +154,11 @@ api:
154154
mail_send: मेल पहले से ही% email% करने के लिए भेज देते हैं। कृपया अपने मेल की जाँच करें।
155155
logged_in: सफलतापूर्वक लॉग इन हो चुका है!
156156
logged_out: सफलतापूर्वक लॉग आउट!
157+
# Password change
158+
change_password:
159+
flash:
160+
success: पासवर्ड बदल दिया गया है
161+
# Password resetting
162+
resetting:
163+
flash:
164+
success: पासवर्ड सफलतापूर्वक रीसेट कर दिया गया है।

src/ApiBundle/Resources/translations/validators.en.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ user:
1919
show_error_perm_edit: Sorry, You are not permitted to edit user profile!
2020
show_error_password_reset: Sorry, You are not permitted to request for password reset!
2121
show_error_reset_req: Password reset request already received
22-
show_error_username_policy: Username should be 3-16 characters long with any lowercase letter (a-z), number (0-9), an underscore, or a hyphen
23-
show_error_password_policy: Password 6-20 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character
22+
show_error_username_policy: Username should be 2-50 characters long with any Uppercase/lowercase letter (A-Za-z), number (0-9), any special character, other than []'"
23+
show_error_password_policy: Password 6-50 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character, other than [ and ]
2424
show_error_role: Sorry! Not a valid Role!

src/ApiBundle/Resources/translations/validators.fr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ user:
2020
show_error_password_reset: Désolé, vous n'êtes pas autorisé à demander une réinitialisation du mot de passe!
2121
show_error_reset_req: Réinitialisation du mot de passe déjà reçue
2222
show_error_server_fault: Erreur du serveur! Veuillez réessayer après un certain temps !!
23-
show_error_username_policy: Le nom d'utilisateur doit comporter entre 3 et 16 caractères avec une lettre minuscule (a-z), un chiffre (0-9), un trait de soulignement ou un tiret
24-
show_error_password_policy: Mot de passe 6 à 20 caractères, au moins 1 majuscule, 1 minuscule, 1 numéro et 1 caractère spécial
23+
show_error_username_policy: Le nom d'utilisateur doit comporter de 2 à 50 caractères avec une lettre majuscule / minuscule (A-Za-z), un numéro (0-9), un caractère spécial, autre que []'"
24+
show_error_password_policy: Mot de passe 6-50 caractères, au moins 1 majuscule, 1 minuscule, 1 numéro et 1 caractère spécial, autres que [et]

src/ApiBundle/Resources/translations/validators.hi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ user:
2020
show_error_password_reset: क्षमा करें, आप पासवर्ड रीसेट के लिए अनुरोध करने के लिए अनुमति नहीं है!
2121
show_error_reset_req: पासवर्ड रीसेट अनुरोध पहले से ही प्राप्त
2222
show_error_server_fault: सर्वर त्रुटि! कुछ समय के बाद फिर से कोशिश करें !!
23-
show_error_username_policy: यूजर का नाम किसी भी छोटा अक्षर (a-z), संख्या (0-9), एक अंडरस्कोर, या एक हाइफन के साथ 3-16 अक्षर का होना चाहिए
24-
show_error_password_policy: पासवर्ड 6-20 अक्षर, कम से कम 1 अपरकेस, 1 लोअरकेस, 1 संख्या और 1 विशेष अक्षर
23+
show_error_username_policy: यूजर का नाम किसी भी अपरकेस / छोटे अक्षर (a-Za-z), संख्या (0-9), किसी भी विशेष वर्ण, [ और ] के अलावा, 2-50 अक्षर का होना चाहिए
24+
show_error_password_policy: पासवर्ड 6-50 अक्षर, कम से कम 1 अपरकेस, 1 लोअरकेस, 1 संख्या और 1 विशेष वर्ण, []'" के अलावा अन्य

0 commit comments

Comments
 (0)