Sign Up

Sign In

Forget Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

Developers Map

How to add password validation in laravel

  • 1

Laravel is a most common framework. it is very easy to use and learn.if you want to add some password validation in your controller like min length of password or Match string according to your requirmentor you want to change error message then use below code :

$validator = Validator::make(Input::all(), [

   'password' => 'required|min:8|confirmed|regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{6,}$/',
],[
      'password.regex' => 'Your password must be longer than 8 characters and must contain at least one uppercase, 
                             one lowercase, and one number.',
      'password.min' => 'Your password must be longer than 8 characters',
]
);
Leave an answer

Leave an answer

Browse