laravel / fortify

Backend controllers and scaffolding for Laravel authentication.

Home Page:https://laravel.com/docs/fortify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing case for password rules combination

stuartcusackie opened this issue · comments

  • Fortify Version: 1.7.5
  • Laravel Version: 8.25.0

Description:

I have set up my password rules like so:

(new Password)
  ->length(10)
  ->requireNumeric()
  ->requireSpecialCharacter(),

It seems there is no case in the message() switch for the above and the error always appears as:
The password must be at least 10 characters.
even if you've met the character count requirements.

Steps:

  1. Create PasswordValidationRules.php in app/Actions/Fortify.
  2. Place content:
<?php

namespace App\Actions\Fortify;

use Laravel\Fortify\Rules\Password;

trait PasswordValidationRules
{
    /**
     * Get the validation rules used to validate passwords.
     *
     * @return array
     */
    protected function passwordRules()
    {
        return [
        	'required',
        	'string',
        	(new Password)
        		  ->length(10)
                          ->requireNumeric()
                          ->requireSpecialCharacter(),
        	'confirmed',
        ];
    }
}

Please provide more specific steps to reproduce this issue.

I've updated my original post above. Thank you.

Yep I see it now. I'll send in a PR.