unicodeveloper / laravel-password

:closed_lock_with_key: :smiling_imp: Guard your users against entering dumb passwords in your Laravel 5 apps

Home Page:http://goodheads.io/2016/07/03/introducing-laravel-password-v1-0/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caching in Database

mattwells opened this issue · comments

Caching the bad passwords list in the default Laravel migration for the cache table using MySQL (text with maximum length of 65k characters) is to big and crops the end of list which causes a decryption error "The payload is invalid." next time someone tries to change their password.

The default Laravel Database Migration is as follows:

Schema::create('cache', function (Blueprint $table) {
    $table->string('key')->unique();
    $table->text('value');
    $table->integer('expiration');
});

In MySQL a text column has a maximum length of 65,535 characters (third paragraph). The length of the cached badpassword.txt in the cache table is 371,428 characters. This means that the end of the list gets cropped when it is being stored which becomes corrupted.

Oh @mattwells I totally get what you mean.

Can you use another cache driver rather than the database driver e.g Redis or Memcached ? I never tested this with the database cache driver.

hi @unicodeveloper for now I have changed the value column to a mediumtext which has solved the issue. I do hope to move across to a dedicated cache solution in the future though.

Thanks, @mattwells. I think I can close this issue now!