diff --git a/app/Http/Controllers/Auth/SocialiteController.php b/app/Http/Controllers/Auth/SocialiteController.php index c9eef54..8fbef9a 100644 --- a/app/Http/Controllers/Auth/SocialiteController.php +++ b/app/Http/Controllers/Auth/SocialiteController.php @@ -70,7 +70,9 @@ public function getSocialRedirect(string $provider, Request $request) } return response()->json([ - 'url' => Socialite::driver($provider)->stateless()->with(['state' => $state])->redirect()->getTargetUrl(), + 'url' => Socialite::driver($provider)->stateless()->with([ + 'state' => $state, + ])->redirect()->getTargetUrl(), ]); } diff --git a/app/Traits/SocialiteProvidersTrait.php b/app/Traits/SocialiteProvidersTrait.php index f48fd80..f4ba2bf 100644 --- a/app/Traits/SocialiteProvidersTrait.php +++ b/app/Traits/SocialiteProvidersTrait.php @@ -448,6 +448,7 @@ protected function loginsList() protected function findOrCreateUser(string $provider, SocialiteUser $user, string $state = null): array { $existingUser = null; + $token = null; if ($state && $state != config('app.key')) { $token = PersonalAccessToken::findToken($state); @@ -458,6 +459,10 @@ protected function findOrCreateUser(string $provider, SocialiteUser $user, strin $existingUser = User::whereEmail($user->getEmail())->first(); } + if (! $existingUser) { + $existingUser = auth('sanctum')->user(); + } + $oauthProvider = SocialiteProvider::where('provider', $provider) ->where('provider_user_id', $user->getId()) ->first(); diff --git a/resources/js/components/account/AccountAuthentication.vue b/resources/js/components/account/AccountAuthentication.vue index 2715910..a5162f2 100644 --- a/resources/js/components/account/AccountAuthentication.vue +++ b/resources/js/components/account/AccountAuthentication.vue @@ -105,7 +105,11 @@ import VueAxios from 'vue-axios'; import { mapState, mapActions, mapGetters } from 'vuex'; import { track } from '@services/analytics'; import { PowerIcon } from '@heroicons/vue/24/outline'; -import { parseDisplayDate, capitalizeFirstLetter } from '@services/common'; +import { + parseDisplayDate, + capitalizeFirstLetter, + providerIcon, +} from '@services/common'; export default { name: 'AccountAuthentication', @@ -179,6 +183,7 @@ export default { track, parseDisplayDate, capitalizeFirstLetter, + providerIcon, providerConnected(provider, user) { const found = user.providers.find((p) => p.provider == provider); if (found) { @@ -186,63 +191,6 @@ export default { } return false; }, - providerIcon(provider) { - if (provider.toLowerCase() == 'apple') { - return 'fa-brands fa-apple text-gray-800 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'twitter') { - return 'fa-brands fa-twitter text-blue-300 dark:text-blue-200'; - } - if (provider.toLowerCase() == 'google') { - return 'fa-brands fa-google text-red-500 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'microsoft') { - return 'fa-brands fa-microsoft text-blue-300 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'tiktok') { - return 'fa-brands fa-tiktok text-pink-600 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'youtube') { - return 'fa-brands fa-youtube text-red-600 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'instagram') { - return 'fa-brands fa-instagram text-gray-800 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'facebook') { - return 'fa-brands fa-facebook text-blue-600 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'github') { - return 'fa-brands fa-github text-gray-700 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'twitch') { - return 'fa-brands fa-twitch text-blue-300 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'linkedin') { - return 'fa-brands fa-linkedin text-blue-900 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'zoho') { - return 'fas fa-z text-yellow-500 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'stackexchange') { - return 'fa-brands fa-stack-exchange text-blue-400 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'gitlab') { - return 'fa-brands fa-square-gitlab text-orange-400 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'reddit') { - return 'fa-brands fa-square-reddit text-orange-700 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'snapchat') { - return 'fa-brands fa-square-snapchat text-yellow-400 dark:text-gray-200'; - } - if (provider.toLowerCase() == 'meetup') { - return 'fa-brands fa-meetup text-red-400 dark:text-gray-200'; - } - - // NEW_PROVIDER_PLUG :: Put New Provider HERE - - return 'fa-solid fa-plug-circle-check text-gray-600 dark:text-gray-200'; - }, triggerRevoke(provider) { const self = this; const title = 'Revoke '; diff --git a/resources/js/router/routes.js b/resources/js/router/routes.js index 7a21744..e7a4fec 100644 --- a/resources/js/router/routes.js +++ b/resources/js/router/routes.js @@ -133,7 +133,7 @@ export default [ path: '/settings', component: Settings, redirect: { - name: 'profile', + name: 'account', }, name: 'settings', meta: { diff --git a/resources/js/services/common.js b/resources/js/services/common.js index 15e3a91..965b954 100644 --- a/resources/js/services/common.js +++ b/resources/js/services/common.js @@ -18,3 +18,75 @@ export function capitalizeFirstLetter(str) { return str.slice(0, 2).toUpperCase() + str.slice(2); } + +export function greeting() { + const date = new Date(); + const currentTime = date.getHours(); + let greeting; + if (currentTime >= 0 && currentTime <= 12) { + greeting = 'Good Morning'; + } else if (currentTime > 12 && currentTime <= 18) { + greeting = 'Good Afternoon'; + } else { + greeting = 'Good Evening'; + } + return greeting; +} + +export function providerIcon(provider = null) { + if (provider.toLowerCase() == 'apple') { + return 'fa-brands fa-apple text-gray-800 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'twitter') { + return 'fa-brands fa-twitter text-blue-300 dark:text-blue-200'; + } + if (provider.toLowerCase() == 'google') { + return 'fa-brands fa-google text-red-500 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'microsoft') { + return 'fa-brands fa-microsoft text-blue-300 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'tiktok') { + return 'fa-brands fa-tiktok text-pink-600 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'youtube') { + return 'fa-brands fa-youtube text-red-600 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'instagram') { + return 'fa-brands fa-instagram text-gray-800 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'facebook') { + return 'fa-brands fa-facebook text-blue-600 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'github') { + return 'fa-brands fa-github text-gray-700 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'twitch') { + return 'fa-brands fa-twitch text-blue-300 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'linkedin') { + return 'fa-brands fa-linkedin text-blue-900 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'zoho') { + return 'fas fa-z text-yellow-500 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'stackexchange') { + return 'fa-brands fa-stack-exchange text-blue-400 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'gitlab') { + return 'fa-brands fa-square-gitlab text-orange-400 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'reddit') { + return 'fa-brands fa-square-reddit text-orange-700 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'snapchat') { + return 'fa-brands fa-square-snapchat text-yellow-400 dark:text-gray-200'; + } + if (provider.toLowerCase() == 'meetup') { + return 'fa-brands fa-meetup text-red-400 dark:text-gray-200'; + } + + // NEW_PROVIDER_PLUG :: Put New Provider HERE + + return 'fa-solid fa-plug-circle-check text-gray-600 dark:text-gray-200'; +} diff --git a/resources/js/views/pages/Dashboard.vue b/resources/js/views/pages/Dashboard.vue index fcc5085..8d4452d 100644 --- a/resources/js/views/pages/Dashboard.vue +++ b/resources/js/views/pages/Dashboard.vue @@ -12,7 +12,7 @@ class="rounded bg-white p-4 dark:bg-slate-800 dark:text-gray-300" >

- {{ greeting }}, + {{ greeting() }}, {{ user && user.name ? user.name : 'Registered User' }}!

@@ -20,6 +20,76 @@

Your Roles

+ +
+ +
+
+ +
+

+ No applications are integrated into your account. +

+
+
+
+
+
+ +
+ {{ provider.provider }} +
+
+ + First Used: + +
+ {{ parseDisplayDate(provider.created_at) }} +
+
+ + Last Used: + +
+ {{ parseDisplayDate(provider.updated_at) }} +
+
+
+
+
+
+
@@ -28,36 +98,67 @@ diff --git a/vite.config.ts b/vite.config.ts index 8c6aed5..c4291f0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,9 +12,7 @@ const fs = require('node:fs'); export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; - var SentryPlugin = null; - if (process.env.VITE_SENTRY_IO_ENABLED) { SentryPlugin = sentryVitePlugin({ include: '.',