LoginSignup
0
0

More than 5 years have passed since last update.

laravel パスワード リセットも 4桁に

Posted at

パスワードリセット時 6桁じゃなくて 4桁にしたい。

ResetsPasswordController.php

    protected function rules()
    {
        return [
            'token' => 'required',
            'email' => 'required|email',
            'password' => 'required|string|min:4|confirmed',
        ];
    }

これを追記しないとデフォルトのやつ使っちゃってControllerの設定がうまくいかない。
必ず追加。

web.php

Route::match(['get', 'post'] , '/password/reset/{token}', 'Auth\ResetPasswordController@reset');
Route::match(['get', 'post'] , '/password/reset/', 'Auth\ResetPasswordController@reset');

しかし、
Passwords must be at least six characters and match the confirmation.
が出るのでこっちも変更

PasswordBroker.php 168行目らへん

    protected function validatePasswordWithDefaults(array $credentials)
    {
        list($password, $confirm) = [
            $credentials['password'],
            $credentials['password_confirmation'],
        ];

        return $password === $confirm && mb_strlen($password) >= 4;
    }


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0