Skip to content

Commit

Permalink
fix: disable password auth when using fromOAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 3, 2024
1 parent e7a50d0 commit 884f04a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,25 @@ public function updatePassword(string $oldPassword, string $newPassword): bool
*/
public function fromOAuth(array $userData): bool
{
$this->checkDbConnection();
$initialPassword = Config::get('password.key');

Config::setUserCache('oauth-token', $userData['token']);
$this->checkDbConnection();
$this->config('password.key', false);

$user = $this->db->select(Config::get('db.table'))->where($userData['user'])->first();

Config::setUserCache('oauth-token', $userData['token']);

if (!$user) {
return $this->register($userData['user']);
$success = $this->register($userData['user']);
$this->config('password.key', $initialPassword);

return $success;
}

$this->user = new User($user);
$this->config('password.key', $initialPassword);

return true;
}

Expand Down

0 comments on commit 884f04a

Please sign in to comment.