mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
add alert with ssowat message
This commit is contained in:
parent
73488092c4
commit
de4f5a59e1
4 changed files with 21 additions and 0 deletions
|
@ -74,6 +74,8 @@ export const usePreferedTheme = async () => {
|
||||||
export const useRedirectUrl = () =>
|
export const useRedirectUrl = () =>
|
||||||
useState<string | null>('redirectUrl', () => null)
|
useState<string | null>('redirectUrl', () => null)
|
||||||
|
|
||||||
|
export const useQueryMsg = () => useState<string | null>('queryMsg', () => null)
|
||||||
|
|
||||||
// SETTINGS
|
// SETTINGS
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import type { User } from '@/composables/states'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const isLoggedIn = useIsLoggedIn()
|
const isLoggedIn = useIsLoggedIn()
|
||||||
|
const queryMsg = useQueryMsg()
|
||||||
const settings = await useSettings()
|
const settings = await useSettings()
|
||||||
const user = await useUser<User | null>()
|
const user = await useUser<User | null>()
|
||||||
|
|
||||||
|
@ -37,6 +38,15 @@ async function logout() {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container mx-auto p-10 min-h-screen flex flex-col">
|
<div class="container mx-auto p-10 min-h-screen flex flex-col">
|
||||||
|
<BaseAlert
|
||||||
|
v-if="queryMsg"
|
||||||
|
variant="warning"
|
||||||
|
icon="alert-outline"
|
||||||
|
:message="t('ssowat.' + queryMsg)"
|
||||||
|
class="mb-4"
|
||||||
|
assertive
|
||||||
|
/>
|
||||||
|
|
||||||
<header class="py-2">
|
<header class="py-2">
|
||||||
<div id="focus-reset" class="h-10 -mt-10 focus-target" tabindex="-1">
|
<div id="focus-reset" class="h-10 -mt-10 focus-target" tabindex="-1">
|
||||||
<a class="link sr-only focus:not-sr-only" href="#main-target">
|
<a class="link sr-only focus:not-sr-only" href="#main-target">
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
"footer": "Skip to footer"
|
"footer": "Skip to footer"
|
||||||
},
|
},
|
||||||
"ssowat": {
|
"ssowat": {
|
||||||
|
"access_denied": "You are not allowed to access this url.",
|
||||||
"protected": "Please log in to access this url."
|
"protected": "Please log in to access this url."
|
||||||
},
|
},
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
useIsLoggedIn,
|
useIsLoggedIn,
|
||||||
useRedirectUrl,
|
useRedirectUrl,
|
||||||
|
useQueryMsg,
|
||||||
useSettings,
|
useSettings,
|
||||||
} from '@/composables/states'
|
} from '@/composables/states'
|
||||||
|
|
||||||
|
@ -18,6 +19,13 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||||
redirectUrl.value = null
|
redirectUrl.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const queryMsg = useQueryMsg()
|
||||||
|
if (to.query.msg) {
|
||||||
|
queryMsg.value = from.query.msg as string
|
||||||
|
} else {
|
||||||
|
queryMsg.value = null
|
||||||
|
}
|
||||||
|
|
||||||
if (to.name === 'login') {
|
if (to.name === 'login') {
|
||||||
if (isLoggedIn.value) {
|
if (isLoggedIn.value) {
|
||||||
return navigateTo('/')
|
return navigateTo('/')
|
||||||
|
|
Loading…
Add table
Reference in a new issue