aboutsummaryrefslogtreecommitdiff
path: root/front-end/src/views/Login
diff options
context:
space:
mode:
Diffstat (limited to 'front-end/src/views/Login')
-rw-r--r--front-end/src/views/Login/components/Totp.vue2
-rw-r--r--front-end/src/views/Login/index.vue6
-rw-r--r--front-end/src/views/Login/pki/index.vue2
-rw-r--r--front-end/src/views/Login/social/[type].vue25
4 files changed, 17 insertions, 18 deletions
diff --git a/front-end/src/views/Login/components/Totp.vue b/front-end/src/views/Login/components/Totp.vue
index 50a5be3..43c05d8 100644
--- a/front-end/src/views/Login/components/Totp.vue
+++ b/front-end/src/views/Login/components/Totp.vue
@@ -24,7 +24,7 @@
<script setup lang="ts">
import { useMessage, useWait } from '@vnuge/vnlib.browser';
-import { toSafeInteger } from 'lodash';
+import { toSafeInteger } from 'lodash-es';
import VOtpInput from "vue3-otp-input";
const emit = defineEmits(['submit'])
diff --git a/front-end/src/views/Login/index.vue b/front-end/src/views/Login/index.vue
index f3a3f59..d0fa9b2 100644
--- a/front-end/src/views/Login/index.vue
+++ b/front-end/src/views/Login/index.vue
@@ -51,7 +51,7 @@ import Social from './components/Social.vue'
import { apiCall, useMessage, useWait, useUser, useSession, useLastPage, useTitle, debugLog } from '@vnuge/vnlib.browser'
import { useMfaLogin, totpMfaProcessor, IMfaFlowContinuiation, MfaMethod } from '@vnuge/vnlib.browser/dist/mfa'
import { useTimeoutFn } from '@vueuse/shared'
-import { isNil } from 'lodash'
+import { isNil } from 'lodash-es'
useTitle('Login')
@@ -64,9 +64,7 @@ const { logout } = useUser();
const { loggedIn } = useSession()
//Setup mfa login
-const { login } = useMfaLogin([
- totpMfaProcessor()
-])
+const { login } = useMfaLogin([ totpMfaProcessor() ])
//If logged in re-route to the last page the user
//was on but delayed to the session has time to be set
diff --git a/front-end/src/views/Login/pki/index.vue b/front-end/src/views/Login/pki/index.vue
index ae1a4a8..4e56151 100644
--- a/front-end/src/views/Login/pki/index.vue
+++ b/front-end/src/views/Login/pki/index.vue
@@ -32,7 +32,7 @@
</template>
<script setup lang="ts">
-import { isEmpty } from 'lodash';
+import { isEmpty } from 'lodash-es';
import { apiCall, debugLog, useUser, useMessage } from '@vnuge/vnlib.browser';
import { ITokenResponse } from '@vnuge/vnlib.browser/dist/session';
import { ref } from 'vue'
diff --git a/front-end/src/views/Login/social/[type].vue b/front-end/src/views/Login/social/[type].vue
index 5a803bd..bdb0240 100644
--- a/front-end/src/views/Login/social/[type].vue
+++ b/front-end/src/views/Login/social/[type].vue
@@ -32,11 +32,12 @@
</template>
<script setup lang="ts">
-import { isEqual } from 'lodash'
+import { isEqual } from 'lodash-es'
import { useRouteParams, useRouteQuery } from '@vueuse/router'
import { useSession, useWait, useUser, useTitle, configureApiCall } from '@vnuge/vnlib.browser'
import { useRouter } from 'vue-router';
import { ref } from 'vue'
+import { ITokenResponse } from '@vnuge/vnlib.browser/dist/session';
useTitle('Social Login')
@@ -76,7 +77,7 @@ const run = async () => {
loginUrl = '/login/social/auth0';
break;
default:
- router.push('/login')
+ router.push({ name: 'Login' })
break;
}
@@ -84,17 +85,17 @@ const run = async () => {
await apiCall(async ({ axios }) => {
const preppedLogin = prepareLogin()
// Send the login request
- const response = await axios.post(loginUrl, { nonce: nonce.value })
- if (response.data.success === true) {
- // Finalize the login
- await preppedLogin.finalize(response)
- // If the login was successful, then we can redirect to the login page
- router.push({ name: 'Login' })
- return
- }
- // Otherwise, we can show an error
- throw { response }
+ const { data } = await axios.post<ITokenResponse>(loginUrl, { nonce: nonce.value })
+
+ data.getResultOrThrow()
+
+ // Finalize the login
+ await preppedLogin.finalize(data)
+
+ // If the login was successful, then we can redirect to the login page
+ router.push({ name: 'Login' })
})
+
} else {
switch (result.value) {
case 'invalid':