मैं FOSUserBundle में पासवर्ड के लिए वर्तमान सत्यापन को ओवरराइड करने का प्रयास कर रहा हूं। मैंने कुछ विकल्पों की कोशिश की है, लेकिन मुझे अभी भी समाधान नहीं मिल रहा है।FOSUserBundle पासवर्ड सत्यापन
पासवर्ड के MINLENGTH बढ़ाने के लिए, मैं के साथ एक validation.yml बनाया:
# src/Acme/UserBundle/Resources/config/validation.yml
Acme\UserBundle\Entity\User:
properties:
username:
- MinLength: { limit: 3, message: "Your username must have at least {{ limit }} characters." }
- MaxLength: { limit: 255, message: "The username is too long" }
- NotBlank: { message: "Please enter a username"}
plainPassword:
- NotBlank: { message: "Please enter a password"}
- MinLength: { limit: 8, message: "Your password must have at least {{ limit }} characters.", groups [Registration,Profile]}
- MaxLength: { limit: 255, message: "The password is too long" }
Acme\UserBundle\Form\Model\ChangePassword:
properties:
new:
- NotBlank: { message: "Please enter a new password", groups [ChangePassword]}
- MinLength: { limit: 8, message: "Your password must have at least {{ limit }} characters.", groups [ChangePassword]}
- MaxLength: { limit: 255, message: "The password is too long", groups [ChangePassword]}
Acme\UserBundle\Form\Model\ResetPassword:
new:
- NotBlank: { message: "Please enter a new password", groups [ResetPassword]}
- MinLength: { limit: 8, message: "Your new password must have at least {{ limit }} characters.", groups [ResetPassword]}
- MaxLength: { limit: 255, message: "The new password is too long", groups [ResetPassword]}
यह /register
पर ठीक मेरे लिए काम कर रहा है, लेकिन /change-password
पर लंबाई सत्यापन मिनट डिफ़ॉल्ट FOSUserBundle से स्वामित्व ले जा रहा है।
मेरे प्रश्न को और स्पष्ट रूप से बताने के लिए, FOSUserBundle में पासवर्ड के लिए MinLength सेट करने का सही तरीका क्या है यह सुनिश्चित करने के लिए कि यह हर जगह मान्य है?
इसके अलावा, FOSUserBundle के साथ सही दृष्टिकोण क्या है जो oldpassword != newpassword
में चेंजपासवर्ड के भीतर सत्यापित करने के लिए है?
यह कुछ मुझे लगता है कि अगर मेरे मुद्दों का कारण था देखने के लिए प्रयास में हटा दिया है। मैंने उन्हें सत्यापित करने के लिए अभी वापस रखा है, ऐसा कोई फर्क नहीं पड़ता है। मैं ऊपर स्पष्ट रूप से उन्हें शामिल करने के लिए संपादित कर दूंगा। – MadManMonty