78 Show
New! Save questions or answers and organize your favorite content. How to added password validation rule in the validator? Validation rule: The password contains characters from at least three of the following five categories:
How to add above rule in the validator rule? My Code Here
Maytham Fahmi 28.3k13 gold badges103 silver badges124 bronze badges asked Jul 21, 2015 at 12:59
BharanikumarBharanikumar 25.2k50 gold badges130 silver badges195 bronze badges 2
I have had a similar scenario in Laravel and solved it in the following way. The password contains characters from at least three of the following five categories:
First, we need to create a regular expression and validate it. Your regular expression would look like this:
I have tested and validated it on this site. Yet, perform your own in your own manner and adjust accordingly. This is only an example of regex, you can manipulate the way you want. So your final Laravel regex rule should be like this:
Note:
Regarding your custom validation message for the regex rule in Laravel, here are a few links to look at:
miken32 40.6k16 gold badges100 silver badges140 bronze badges answered Jul 21, 2015 at 21:24
Maytham FahmiMaytham Fahmi 28.3k13 gold badges103 silver badges124 bronze badges 7 This doesn't quite match the OP requirements, though hopefully it helps. With Laravel you can define your rules in an easy-to-maintain format like so:
Would output:
(The regex rules share an error message by default—i.e. four failing regex rules result in one error message) answered Jan 22, 2019 at 14:55
6 Since Laravel version 8, you can use built-in password validation:
or you can chain them all
miken32 40.6k16 gold badges100 silver badges140 bronze badges answered May 24, 2021 at 10:30
Moode OsmanMoode Osman 1,37515 silver badges14 bronze badges 2 A Custom Laravel Validation Rule will allow developers to provide a custom message with each use case for a better UX experience.
Then on your request validation:
answered Nov 19, 2020 at 14:56
ahinkleahinkle 1,8603 gold badges28 silver badges49 bronze badges 0 it's easy to do so with laravel 8:
See the doc , ( in your case you can ignore the uncompromised rule). answered Jun 17, 2021 at 11:59
ali filali ali filali 1803 silver badges7 bronze badges 1
answered Jun 16 at 5:14
Which of the following is a document that states in writing how a company plans to protect the company physical and IT assets?A security policy is a document that states in writing how a company plans to protect its physical and information technology (IT) assets.
Is a program in which malicious or harmful code is contained inside apparently harmless programming or data?In computers, a Trojan horse is a program in which malicious or harmful code is contained inside apparently harmless programming or data in such a way that it can get control and do its chosen form of damage, such as ruining the file allocation table on your hard disk.
What is the process of conversion of data into a ciphertext that Cannot be easily understood by unauthorized people known as?Encryption is the method by which information is converted into secret code that hides the information's true meaning. The science of encrypting and decrypting information is called cryptography. In computing, unencrypted data is also known as plaintext, and encrypted data is called ciphertext.
What is a program or file that is specifically developed for the purpose of doing harm?Malware, or malicious software, is any program or file that is intentionally harmful to a computer, network or server. Types of malware include computer viruses, worms, Trojan horses, ransomware and spyware.
|