Skip to content

Update styling #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions src/DumbPasswordServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,40 @@

class DumbPasswordServiceProvider extends ServiceProvider
{

/*
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;

/**
* default error message
* Default error message.
*
* @var string
*/
protected $message = 'This password is just too common. Please try another!';

/**
* Publishes all the config file this package needs to function
*/
* Publishes all the config file this package needs to function.
*/
public function boot()
{
$path = realpath(__DIR__.'/../resources/config/passwordlist.txt');
$dumbPasswords = collect(explode("\n", file_get_contents($path)));
$data = $dumbPasswords->flip();

Validator::extend('dumbpwd', function($attribute, $value, $parameters, $validator) use ($data) {
Validator::extend('dumbpwd', function ($attribute, $value, $parameters, $validator) use ($data) {
return !$data->has($value);
}, $this->message);
}, $this->message);
}

/**
* Register the application services.
*/
* Register the application services.
*/
public function register()
{

//
}

/**
* Get the services provided by the provider
* @return array
*/
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['laravel-password'];
Expand Down