This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,13 @@ protected function applyPassword($password)
84
84
*/
85
85
protected function passwordNeedsUpdate ($ password = null ) : bool
86
86
{
87
- $ current = $ this ->currentPassword ();
87
+ $ current = $ this ->currentModelPassword ();
88
88
89
- return is_null ($ current ) || ! Hash::check ($ password , $ current );
89
+ if ($ this ->canSync ()) {
90
+ return ! Hash::check ($ password , $ current );
91
+ }
92
+
93
+ return is_null ($ current );
90
94
}
91
95
92
96
/**
@@ -116,7 +120,7 @@ protected function password()
116
120
*
117
121
* @return string|null
118
122
*/
119
- protected function currentPassword ()
123
+ protected function currentModelPassword ()
120
124
{
121
125
return $ this ->model ->getAttribute ($ this ->column ());
122
126
}
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ public function passwords_are_synced_when_enabled()
198
198
}
199
199
200
200
/** @test */
201
- public function passwords_are_not_synced_when_enabled ()
201
+ public function passwords_are_not_synced_when_sync_is_disabled ()
202
202
{
203
203
config (['adldap_auth.passwords.sync ' => false ]);
204
204
@@ -215,6 +215,25 @@ public function passwords_are_not_synced_when_enabled()
215
215
$ this ->assertFalse (Hash::check ($ credentials ['password ' ], $ user ->password ));
216
216
}
217
217
218
+ /** @test */
219
+ public function passwords_are_not_updated_when_sync_is_disabled ()
220
+ {
221
+ config (['adldap_auth.passwords.sync ' => false ]);
222
+
223
+ $ credentials = [
224
+
225
+ 'password ' => '12345 ' ,
226
+ ];
227
+
228
+ $ this ->auth_passes ($ credentials );
229
+
230
+ $ user = EloquentUser::first ();
231
+
232
+ $ this ->auth_passes ($ credentials );
233
+
234
+ $ this ->assertEquals ($ user ->password , $ user ->fresh ()->password );
235
+ }
236
+
218
237
/** @test */
219
238
public function trashed_rule_prevents_deleted_users_from_logging_in ()
220
239
{
You can’t perform that action at this time.
0 commit comments