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

Commit a7a1d02

Browse files
authored
Small PR changes
1 parent 36cc5ef commit a7a1d02

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Auth/DatabaseUserProvider.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,21 @@ public function validateCredentials(Authenticatable $model, array $credentials)
135135
// validation rules pass, we will allow the authentication
136136
// attempt. Otherwise, it is automatically rejected.
137137
if ($this->newValidator($this->getRules($this->user, $model))->passes()) {
138+
$password = null;
139+
138140
// We'll check if we've been given a password and that
139141
// syncing password is enabled. Otherwise we'll
140142
// use a random 16 character string.
141-
142-
$password = null;
143143
if ($this->isSyncingPasswords()) {
144144
$password = $credentials['password'];
145-
} else {
146-
if(null === $model->password || empty($model->password)) {
147-
// password unset
148-
$password = str_random();
149-
}
145+
} else if (is_null($model->password) || empty($model->password)) {
146+
$password = str_random();
150147
}
151148

152149
// If the model has a set mutator for the password then we'll
153150
// assume that we're using a custom encryption method for
154151
// passwords. Otherwise we'll bcrypt it normally.
155-
if(null !== $password) {
152+
if(! is_null($password)) {
156153
$model->password = $model->hasSetMutator('password') ?
157154
$password : bcrypt($password);
158155
}

0 commit comments

Comments
 (0)