-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
face273
commit 73cd6c2
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |