Update for PHP 8 (#17)

* Update for PHP 8

* Switch to bjeavons/zxcvbn-php-library
This commit is contained in:
Marcus Olsson 2020-12-06 11:08:14 +01:00 committed by GitHub
parent 4fff615d5f
commit 7032f90820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 18 deletions

View File

@ -11,17 +11,13 @@ script:
matrix:
include:
- php: 7.1
env: ILLUMINATE_VERSION=5.8.*
- php: 7.2
- php: 7.3
env: ILLUMINATE_VERSION=^6.0
- php: 7.2
env: ILLUMINATE_VERSION=^7.0
- php: 7.3
env: ILLUMINATE_VERSION=^7.0
- php: 7.4
env: ILLUMINATE_VERSION=^7.0
- php: 7.3
env: ILLUMINATE_VERSION=^8.0
- php: 7.4
env: ILLUMINATE_VERSION=^8.0
- php: 8.0
env: ILLUMINATE_VERSION=^8.0

View File

@ -1,6 +1,6 @@
# The MIT License (MIT)
Copyright (c) 2019 Marcus Olsson <contact@marcusolsson.me>
Copyright (c) 2020 Marcus Olsson <contact@marcusolsson.me>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal

View File

@ -10,7 +10,7 @@
A simple implementation of zxcvbn for Laravel. This package allows you to access "zxcvbn-related" data on a passphrase in the application and also to use zxcvbn as a standard validator.
Uses [Zxcvbn-PHP](https://github.com/mkopinsky/zxcvbn-php) by [@mkopinsky](https://github.com/mkopinsky) (originally by [@bjeavons](https://github.com/bjeavons)), which in turn is inspired by [zxcvbn](https://github.com/dropbox/zxcvbn) by [@dropbox](https://github.com/dropbox).
Uses [Zxcvbn-PHP](https://github.com/bjeavons/zxcvbn-php) by [@bjeavons](https://github.com/bjeavons) and [@mkopinsky](https://github.com/mkopinsky), which in turn is inspired by [zxcvbn](https://github.com/dropbox/zxcvbn) by [@dropbox](https://github.com/dropbox).
## Install
@ -110,7 +110,7 @@ This is a bit more interesting. `zxcvbn_dictionary` allows you to input both the
'email' => 'trash@thedumpster.com'
];
$validator = Validator::make($password, [
'password' => 'zxcvbn_dictionary:' . $data['username'] . ',' . $data['email'] . '|required',
'password' => sprintf('required|zxcvbn_dictionary:%s,%s', $data['username'], $data['email'])
]);
dd($validator->passes());
@ -125,7 +125,7 @@ This is a bit more interesting. `zxcvbn_dictionary` allows you to input both the
'email' => 'mycomplicatedphrase@thedumpster.com'
];
$validator = Validator::make($password, [
'password' => 'zxcvbn_dictionary:' . $data['username'] . ',' . $data['email'] . '|required',
'password' => sprintf('required|zxcvbn_dictionary:%s,%s', $data['username'], $data['email'])
]);
dd($validator->passes());
@ -148,7 +148,7 @@ $ phpunit
The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.
© 2019 [Marcus Olsson](https://marcusolsson.me).
© 2020 [Marcus Olsson](https://marcusolsson.me).
[ico-version]: https://img.shields.io/packagist/v/olssonm/l5-zxcvbn.svg?style=flat-square

View File

@ -20,13 +20,13 @@
}
],
"require": {
"php" : "^7.1",
"illuminate/support": ">=5.8|^6.0|^7.0|^8.0",
"mkopinsky/zxcvbn-php": "^4.4"
"php": "^7.3|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"bjeavons/zxcvbn-php": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.0",
"orchestra/testbench": ">=3.4.0"
"phpunit/phpunit": "^8.0|^9.0",
"orchestra/testbench": ">=4.0"
},
"autoload": {
"psr-4": {

View File

@ -36,7 +36,7 @@ class ZxcvbnServiceProvider extends ServiceProvider
});
/**
* Extend the Laravel Validator with the "zxcvbn_min" rule
* Extend the Laravel Validator with the "zxcvbn_dictionary" rule
*/
Validator::extend('zxcvbn_dictionary', function($attribute, $value, $parameters) {
$email = null;