Skip to content

A free open source IT asset/license management system

Gogle Auth: Fixed FD-56032 - check for activated flag

snipe5fea2fadc0b3
diff --git a/app/Http/Controllers/GoogleAuthController.php b/app/Http/Controllers/GoogleAuthController.php
index be3c58e78c..a1e7118fa7 100644
--- a/app/Http/Controllers/GoogleAuthController.php
+++ b/app/Http/Controllers/GoogleAuthController.php
@@ -48,9 +48,18 @@ class GoogleAuthController extends Controller
);
}
- $user = User::where('username', $socialUser->getEmail())->first();
+ $user = User::where('username', $socialUser->getEmail())
+ ->whereNull('deleted_at')
+ ->first();
if ($user) {
+ if (! $user->activated) {
+ Log::debug('Google user '.$socialUser->getEmail().' is deactivated in Snipe-IT');
+
+ return redirect()->route('login')
+ ->withErrors(['username' => [trans('auth/message.account_not_activated')]]);
+ }
+
Log::debug('Google user '.$socialUser->getEmail().' found in Snipe-IT');
$user->update([
'avatar' => $socialUser->avatar,