Merge pull request #5942 from christianbeeznest/storm-22225

User: Hide Registration link and button based on allow_registration setting - refs BT#22225
pull/5943/head
Nicolas Ducoulombier 10 months ago committed by GitHub
commit 1104d82768
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      assets/vue/components/Login.vue
  2. 66
      assets/vue/components/layout/TopbarNotLoggedIn.vue
  3. 3
      src/CoreBundle/Controller/PlatformConfigurationController.php
  4. 7
      var/vue_templates/components/SidebarLogin.vue
  5. 74
      var/vue_templates/components/layout/SidebarNotLoggedIn.vue

@ -49,6 +49,7 @@
/>
<a
v-if="allowRegistration"
v-t="'Register oneself'"
class="btn btn--primary-outline"
href="/main/auth/inscription.php"
@ -72,7 +73,7 @@
</template>
<script setup>
import { ref } from "vue"
import { ref, computed } from "vue"
import Button from "primevue/button"
import InputText from "primevue/inputtext"
import Password from "primevue/password"
@ -80,8 +81,11 @@ import InputSwitch from "primevue/inputswitch"
import { useI18n } from "vue-i18n"
import { useLogin } from "../composables/auth/login"
import ExternalLoginButtons from "./login/LoginExternalButtons.vue"
import { usePlatformConfig } from "../store/platformConfig"
const { t } = useI18n()
const platformConfigStore = usePlatformConfig()
const allowRegistration = computed(() => "false" !== platformConfigStore.getSetting("registration.allow_registration"))
const { redirectNotAuthenticated, performLogin, isLoading } = useLogin()

@ -15,6 +15,7 @@ import { useI18n } from "vue-i18n"
import { useRouter } from "vue-router"
import { useLocale } from "../../composables/locale"
import PlatformLogo from "./PlatformLogo.vue"
import {usePlatformConfig} from "../../store/platformConfig"
const { t } = useI18n()
const router = useRouter()
@ -27,31 +28,42 @@ const languageItems = languageList.map((language) => ({
command: (event) => reloadWithLocale(event.item.isoCode),
}))
const menuItems = computed(() => [
{
label: t("Home"),
url: router.resolve({ name: "Index" }).href,
},
{
label: t("FAQ"),
url: router.resolve({ name: "Faq" }).href,
},
{
label: t("Registration"),
url: "/main/auth/inscription.php",
},
{
label: t("Demo"),
url: router.resolve({ name: "Demo" }).href,
},
{
label: t("Contact"),
url: "/contact",
},
{
key: "language_selector",
label: currentLanguageFromList.originalName,
items: languageItems,
},
])
const platformConfigStore = usePlatformConfig()
const allowRegistration = computed(() => "false" !== platformConfigStore.getSetting("registration.allow_registration"))
const menuItems = computed(() => {
const items = [
{
label: t("Home"),
url: router.resolve({ name: "Index" }).href,
},
{
label: t("FAQ"),
url: router.resolve({ name: "Faq" }).href,
},
{
label: t("Demo"),
url: router.resolve({ name: "Demo" }).href,
},
{
label: t("Contact"),
url: "/contact",
},
{
key: "language_selector",
label: currentLanguageFromList.originalName,
items: languageItems,
},
]
if (allowRegistration.value) {
items.splice(2, 0, {
label: t("Registration"),
url: "/main/auth/inscription.php",
})
}
console.log("Menu Items:", items)
return items
})
</script>

@ -45,6 +45,9 @@ class PlatformConfigurationController extends AbstractController
'visual_theme' => $this->themeHelper->getVisualTheme(),
'external_authentication' => $this->authenticationConfigHelper->getEnabledProviders(),
];
$configuration['settings']['registration.allow_registration'] = $settingsManager->getSetting('registration.allow_registration', true);
$variables = [];
if ($this->isGranted('ROLE_USER')) {

@ -1,11 +1,12 @@
<script setup>
import { ref } from "vue"
import {computed, ref} from "vue"
import { useI18n } from "vue-i18n"
import InputText from "primevue/inputtext"
import Password from "primevue/password"
import Button from "primevue/button"
import InputSwitch from "primevue/inputswitch"
import { useLogin } from "../../../assets/vue/composables/auth/login"
import {usePlatformConfig} from "../../../assets/vue/store/platformConfig"
const { t } = useI18n()
@ -15,6 +16,9 @@ const login = ref("")
const password = ref("")
const remember = ref(false)
const platformConfigStore = usePlatformConfig()
const allowRegistration = computed(() => "false" !== platformConfigStore.getSetting("registration.allow_registration"))
function onSubmitLoginForm() {
performLogin({
login: login.value,
@ -74,6 +78,7 @@ function onSubmitLoginForm() {
/>
<a
v-if="allowRegistration"
v-t="'Register oneself'"
class="btn btn--primary-outline"
href="/main/auth/inscription.php"

@ -7,6 +7,7 @@ import Dropdown from "primevue/dropdown"
import SidebarLogin from "../SidebarLogin.vue"
import PageList from "../../../../assets/vue/components/page/PageList.vue"
import { useLocale } from "../../../../assets/vue/composables/locale"
import { usePlatformConfig } from "../../../../assets/vue/store/platformConfig"
const { t } = useI18n()
const router = useRouter()
@ -22,37 +23,48 @@ const languageItems = languageList.map((language) => ({
isoCode: language.isocode,
}))
const menuItems = computed(() => [
{
label: t("Home"),
url: router.resolve({ name: "Index" }).href,
},
{
id: "login-header-item",
label: t("Login"),
items: [
{
id: "login-form-item",
},
],
},
{
label: t("Registration"),
url: "/main/auth/inscription.php",
},
{
label: t("Demo"),
url: router.resolve({ name: "Demo" }).href,
},
{
label: t("FAQ"),
url: router.resolve({ name: "Faq" }).href,
},
{
label: t("Contact"),
url: "/contact",
},
])
const platformConfigStore = usePlatformConfig()
const allowRegistration = computed(() => "false" !== platformConfigStore.getSetting("registration.allow_registration"))
const menuItems = computed(() => {
const items = [
{
label: t("Home"),
url: router.resolve({ name: "Index" }).href,
},
{
id: "login-header-item",
label: t("Login"),
items: [
{
id: "login-form-item",
},
],
},
{
label: t("Demo"),
url: router.resolve({ name: "Demo" }).href,
},
{
label: t("FAQ"),
url: router.resolve({ name: "Faq" }).href,
},
{
label: t("Contact"),
url: "/contact",
},
]
if (allowRegistration.value) {
items.splice(2, 0, {
label: t("Registration"),
url: "/main/auth/inscription.php",
})
}
return items
})
const sidebarIsOpen = ref(window.localStorage.getItem("sidebarIsOpen") === "true")

Loading…
Cancel
Save