Skip to content

Commit 73cd6c2

Browse files
committed
initial
1 parent face273 commit 73cd6c2

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

composer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "imanghafoori/laravel-anypass",
3+
"description": "A minimal yet powerful package to help you in development.",
4+
"keywords": ["laravel","laravel-utility","laravel5-package","PHP","laravel5"],
5+
"license": "MIT",
6+
"homepage": "https://github.com/imanghafoori1/laravel-anypass",
7+
"authors": [
8+
{
9+
"name": "Iman Ghafoori",
10+
"email": "imanghafoori1@gmail.com"
11+
}
12+
],
13+
"require": {
14+
"php": ">=5.6.0",
15+
"laravel/framework":"~5.3"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"Imanghafoori\\AnyPass\\": "src"
20+
}
21+
},
22+
"extra": {
23+
"laravel": {
24+
"providers": [
25+
"Imanghafoori\\AnyPass\\AnyPassServiceProvider"
26+
]
27+
}
28+
}
29+
}

src/AnyPassServiceProvider.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Imanghafoori\AnyPass;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class AnyPassServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Bootstrap any application services.
11+
*
12+
* @return void
13+
*/
14+
public function boot()
15+
{
16+
17+
}
18+
/**
19+
* Register any application services.
20+
*
21+
* @return void
22+
*/
23+
public function register()
24+
{
25+
\Auth::provider('AnyPass', function ($app, array $config) {
26+
return new AnyPassUserProvider($app['hash'] ,$config["model"]);
27+
});
28+
}
29+
}

src/AnyPassUserProvider.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Imanghafoori\AnyPass;
4+
5+
use Illuminate\Auth\EloquentUserProvider;
6+
7+
class AnyPassUserProvider extends EloquentUserProvider
8+
{
9+
10+
/**
11+
* Validate a user against the given credentials.
12+
*
13+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
14+
* @param array $credentials
15+
* @return bool
16+
*/
17+
public function validateCredentials(UserContract $user, array $credentials)
18+
{
19+
if (env('APP_DEBUG') == true && env('APP_ENV') === 'local')
20+
{
21+
return true;
22+
}
23+
parent::validateCredentials($user, $credentials);
24+
}
25+
}

0 commit comments

Comments
 (0)