mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Display text when login on new-admin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM python:3.12-alpine AS base
|
||||
FROM python:3.12-alpine3.20 AS base
|
||||
|
||||
LABEL org.opencontainers.image.authors="Antoine Nguyen <tonio@ngyn.org>"
|
||||
ENV VIRTUAL_ENV=/opt/venv
|
||||
|
||||
@@ -280,15 +280,21 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (!authStore.authUser) {
|
||||
await authStore.initialize()
|
||||
}
|
||||
authStore.validateAccess()
|
||||
if (to.meta.allowedRoles !== undefined) {
|
||||
if (to.meta.allowedRoles.indexOf(authStore.authUser.role) === -1) {
|
||||
const isAuth = await authStore.validateAccess()
|
||||
if (isAuth) {
|
||||
if (to.meta.allowedRoles !== undefined) {
|
||||
if (to.meta.allowedRoles.indexOf(authStore.authUser.role) === -1) {
|
||||
next({ name: 'Dashboard' })
|
||||
return
|
||||
}
|
||||
}
|
||||
if (to.meta.requiresMailbox && !authStore.authUser.mailbox) {
|
||||
next({ name: 'Dashboard' })
|
||||
return
|
||||
}
|
||||
}
|
||||
if (to.meta.requiresMailbox && !authStore.authUser.mailbox) {
|
||||
next({ name: 'Dashboard' })
|
||||
} else {
|
||||
next({ name: 'Login' })
|
||||
return
|
||||
}
|
||||
}
|
||||
next()
|
||||
|
||||
@@ -115,11 +115,11 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
async function validateAccess() {
|
||||
const user = await manager.getUser()
|
||||
if (!user || user.expired) {
|
||||
manager.signinRedirect()
|
||||
return
|
||||
return false
|
||||
}
|
||||
repository.defaults.headers.common.Authorization = `Bearer ${user.access_token}`
|
||||
repository.defaults.headers.post['Content-Type'] = 'application/json'
|
||||
return true
|
||||
}
|
||||
|
||||
async function login() {
|
||||
@@ -145,6 +145,8 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return user
|
||||
} catch (error) {
|
||||
console.error('Error completing login:', error)
|
||||
// Redirect to Dashboard so the router will attempt again login
|
||||
router.push({ name: 'Dashboard' })
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,18 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-container class="fill-height" fluid>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col cols="auto" class="text-center">
|
||||
<h1 class="ma-5">{{ $gettext('Attempting to log you in.') }}</h1>
|
||||
<v-progress-circular
|
||||
color="primary"
|
||||
indeterminate
|
||||
:size="128"
|
||||
:width="12"
|
||||
align-self="center"
|
||||
></v-progress-circular>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
@@ -13,8 +13,15 @@ onMounted(() => authStore.login())
|
||||
<template>
|
||||
<v-container class="fill-height" fluid>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col>
|
||||
<h1>{{ $gettext('Attempting to log you in.') }}</h1>
|
||||
<v-col cols="auto" class="text-center">
|
||||
<h1 class="ma-5">{{ $gettext('Attempting to log you in.') }}</h1>
|
||||
<v-progress-circular
|
||||
color="primary"
|
||||
indeterminate
|
||||
:size="128"
|
||||
:width="12"
|
||||
align-self="center"
|
||||
></v-progress-circular>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
Reference in New Issue
Block a user