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

Commit 07a0dcb

Browse files
committed
Set password on every login in case of update in active directory
- Fixes #12
1 parent b44ec48 commit 07a0dcb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/AdldapAuthUserProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ protected function getModelFromAdldap(User $user, $password)
100100
// Try to retrieve the model from the model key and AD username
101101
$model = $this->createModel()->newQuery()->where([$key => $username])->first();
102102

103-
if(!$model) {
104-
$model = $this->createModel();
103+
// Create the model instance of it isn't found
104+
if(!$model) $model = $this->createModel();
105105

106-
$model->{$key} = $username;
107-
$model->password = bcrypt($password);
108-
}
106+
// Set the username and password in case
107+
// of changes in active directory
108+
$model->{$key} = $username;
109+
$model->password = bcrypt($password);
109110

111+
// Synchronize other active directory
112+
// attributes on the model
110113
$model = $this->syncModelFromAdldap($user, $model);
111114

112115
if($this->getBindUserToModel()) {

0 commit comments

Comments
 (0)