Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit c7b1208

Browse files
committed
Small tweaks.
1 parent bf0a6d4 commit c7b1208

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adldap2/adldap2-laravel",
3-
"description": "Adldap2 for Laravel 5",
3+
"description": "Adldap2 for Laravel 5.",
44
"keywords": ["adldap", "adldap2", "ldap", "laravel"],
55
"license": "MIT",
66
"type": "project",

src/AdldapAuthServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ public function boot()
2323
{
2424
$auth = __DIR__.'/Config/auth.php';
2525

26-
$this->mergeConfigFrom($auth, 'adldap_auth');
27-
26+
// Add publishable configuration.
2827
$this->publishes([
2928
$auth => config_path('adldap_auth.php'),
3029
], 'adldap');
3130

31+
$this->mergeConfigFrom($auth, 'adldap_auth');
32+
33+
// Extend Laravel authentication with Adldap driver.
3234
Auth::extend('adldap', function($app) {
3335
return new AdldapAuthUserProvider($app['hash'], $app['config']['auth.model']);
3436
});

src/AdldapAuthUserProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ public function retrieveByCredentials(array $credentials)
5252
// Retrieve the first user result
5353
$user = $query->first();
5454

55-
// If the user is an Adldap user
55+
// If the user is an Adldap User model instance.
5656
if($user instanceof User) {
57-
// Retrieve the users login attribute
57+
// Retrieve the users login attribute.
5858
$username = $user->{$this->getLoginAttribute()};
5959

6060
if(is_array($username)) {
6161
$username = Arr::get($username, 0);
6262
}
6363

64-
// Try to log the user in
64+
// Try to log the user in.
6565
if($this->authenticate($username, $credentials['password'])) {
6666
// Login was successful, we'll create a new
67-
// Laravel model with the Adldap user
67+
// Laravel model with the Adldap user.
6868
return $this->getModelFromAdldap($user, $credentials['password']);
6969
}
7070
}
@@ -141,7 +141,7 @@ protected function syncModelFromAdldap(User $user, Authenticatable $model)
141141
$model->{$modelField} = $adValue;
142142
}
143143

144-
// Only save models that contain changes
144+
// Only save models that contain changes.
145145
if(count($model->getDirty()) > 0) {
146146
$model->save();
147147
}

src/AdldapServiceProvider.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public function boot()
2222
{
2323
$config = __DIR__.'/Config/config.php';
2424

25-
$this->mergeConfigFrom($config, 'adldap');
26-
2725
$this->publishes([
2826
$config => config_path('adldap.php'),
2927
], 'adldap');
28+
29+
$this->mergeConfigFrom($config, 'adldap');
3030
}
3131

3232
/**
@@ -49,7 +49,8 @@ public function register()
4949
return new Adldap($config['connection_settings'], new $config['connection'], $config['auto_connect']);
5050
});
5151

52-
// Bind the Adldap contract to the Adldap implementation
52+
// Bind the Adldap contract to the Adldap object
53+
// in the IoC for dependency injection.
5354
$this->app->bind('Adldap\Contracts\Adldap', 'adldap');
5455
}
5556

0 commit comments

Comments
 (0)