Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed May 5, 2018
1 parent face273 commit 73cd6c2
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
29 changes: 29 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "imanghafoori/laravel-anypass",
"description": "A minimal yet powerful package to help you in development.",
"keywords": ["laravel","laravel-utility","laravel5-package","PHP","laravel5"],
"license": "MIT",
"homepage": "https://github.com/imanghafoori1/laravel-anypass",
"authors": [
{
"name": "Iman Ghafoori",
"email": "imanghafoori1@gmail.com"
}
],
"require": {
"php": ">=5.6.0",
"laravel/framework":"~5.3"
},
"autoload": {
"psr-4": {
"Imanghafoori\\AnyPass\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Imanghafoori\\AnyPass\\AnyPassServiceProvider"
]
}
}
}
29 changes: 29 additions & 0 deletions src/AnyPassServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Imanghafoori\AnyPass;

use Illuminate\Support\ServiceProvider;

class AnyPassServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{

}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
\Auth::provider('AnyPass', function ($app, array $config) {
return new AnyPassUserProvider($app['hash'] ,$config["model"]);
});
}
}
25 changes: 25 additions & 0 deletions src/AnyPassUserProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Imanghafoori\AnyPass;

use Illuminate\Auth\EloquentUserProvider;

class AnyPassUserProvider extends EloquentUserProvider
{

/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
{
if (env('APP_DEBUG') == true && env('APP_ENV') === 'local')
{
return true;
}
parent::validateCredentials($user, $credentials);
}
}

0 comments on commit 73cd6c2

Please sign in to comment.