diff options
author | vnugent <public@vaughnnugent.com> | 2024-01-30 15:23:06 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-01-30 15:23:06 -0500 |
commit | 5abc489b9954111d66d1385aa62a3ea962fa0a55 (patch) | |
tree | b1715e5c5e6316f33e3e33fb55397d93200ab518 /front-end/src/views/Login/index.vue | |
parent | e4dc63ded324c6e9678603296953bb1f7dea7569 (diff) |
merge upstream. Add dynamic client-side support for optional oauth2 and social login methods
Diffstat (limited to 'front-end/src/views/Login/index.vue')
-rw-r--r-- | front-end/src/views/Login/index.vue | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/front-end/src/views/Login/index.vue b/front-end/src/views/Login/index.vue index 6a55aeb..476ebf4 100644 --- a/front-end/src/views/Login/index.vue +++ b/front-end/src/views/Login/index.vue @@ -1,3 +1,38 @@ +<script setup lang="ts"> +import { computed } from 'vue' +import { apiCall, useWait } from '@vnuge/vnlib.browser' +import { isNil } from 'lodash-es' +import { useStore } from '../../store' +import { storeToRefs } from 'pinia' +import UserPass from './components/UserPass.vue' +import Social from './components/Social.vue' + +const store = useStore(); +const { loggedIn } = storeToRefs(store) +const pkiEnabled = computed(() => !isNil(store.pki?.pkiAuth)) + +store.setPageTitle('Login') + +const { waiting } = useWait() + +const submitLogout = async () => { + //Submit logout request + await apiCall(async ({ toaster }) => { + const { logout } = await store.socialOauth() + // Attempt to logout + await logout() + // Push a new toast message + toaster.general.success({ + id: 'logout-success', + title: 'Success', + text: 'You have been logged out', + duration: 5000 + }) + }) +} + +</script> + <template> <div id="login-template" class="app-component-entry"> <div class="login-container"> @@ -25,7 +60,7 @@ <Social /> <!-- pki button, forward to the pki route --> - <div v-if="pkiEnabled" class="mt-3"> + <div v-if="pkiEnabled" class="mt-4"> <router-link to="/login/pki"> <button type="submit" class="btn red social-button" :disabled="waiting"> <fa-icon :icon="['fa','certificate']" size="xl" /> @@ -39,44 +74,6 @@ </div> </template> -<script setup lang="ts"> -import { } from 'vue' -import { apiCall, useWait } from '@vnuge/vnlib.browser' -import { isNil } from 'lodash-es' -import { useStore } from '../../store' -import { storeToRefs } from 'pinia' -import UserPass from './components/UserPass.vue' -import Social from './components/Social.vue' - -//pki enabled flag from env -const pkiEnabled = !isNil(import.meta.env.VITE_PKI_ENABLED); - -const store = useStore(); -const { loggedIn } = storeToRefs(store) - -store.setPageTitle('Login') - -const { waiting } = useWait() - -const submitLogout = async () => { - //Submit logout request - await apiCall(async ({ toaster }) => { - // Attempt to logout - const { logout } = await store.socialOauth() - await logout() - - // Push a new toast message - toaster.general.success({ - id: 'logout-success', - title: 'Success', - text: 'You have been logged out', - duration: 5000 - }) - }) -} - -</script> - <style lang="scss"> #login-template { .login-container{ |