Notify User to Ignore Common Passwords in Laravel

Sometimes users choose a common password like “123456“, “abcde” etc. as their password. In this article, I’m going to share how to ignore the common password in Laravel. Let’s get started:

Table of Contents

  1. Install Package & Config
  2. Modify RegisterController
  3. Run and Test

Install Package & Config

We’ll use unicodeveloper/laravel-password package to do this. This package requires PHP 5.5+ or HHVM 3.3+.

composer require unicodeveloper/laravel-password

If you’re on Laravel < 5.5, you’ll need to register the service provider. Open up config/app.php and add the following to the providers array:

'providers' => [

By default, the error message returned is “This password is just too common. Please try another!”.

You can customize the error message by opening resources/lang/en/validation.php and adding to the array like so:

'dumbpwd' => 'You are using a dumb password. Please try another!',

Modify RegisterController

Open app/Http/Controllers/Auth/RegisterController.php. We need to use the rule dumbpwd in validation like so:

protected function validator(array $data)
    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|min:6|dumbpwd|confirmed',

Run and Test

Now run the project:

php artisan serve

And test by entering common password. You’ll see the output like:

That’s it. Thanks for reading. ?