Skip to content

Commit

Permalink
Добавлены новые проверки для трэйта GuardTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashagm committed Jun 21, 2023
1 parent f7ac6cd commit b5e773d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Traits/GuardTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ private function checkSocialsIsActive($user = null)

private function isAccess($email)
{
if (!config('socials.user.access_colum') || !config('socials.user.access_value')) {
abort(500, 'Social auth configuration error: access_colum or access_value not set');
}

$user = User::where('email', $email)->first();

if (!$user) {
Expand All @@ -42,6 +46,14 @@ private function isAccess($email)

private function checkProvider($user, $provider)
{
if (!$user) {
throw new \InvalidArgumentException('User not found!');
}

if (!config('socials.isProvider')) {
throw new \InvalidArgumentException('Provider not found!');
}

$guard = config('socials.isProvider');

switch ($guard) {
Expand Down

0 comments on commit b5e773d

Please sign in to comment.