Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

パスワードリセット時 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;
    }


ma7ma7pipipi
こんばんわ。PHP界の神です。 お仕事下さい。 浮気したことは人生で1度もありません。 一途なので。
https://okws.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away