Skip to content
Snippets Groups Projects
Commit 8ec33bad authored by Florent Lavelle's avatar Florent Lavelle Committed by m431m
Browse files

Add `forms.signup.disabled` to `config.js`

parent b0165d20
No related branches found
No related tags found
No related merge requests found
export default {
forms: {
signup: {
disabled: false,
hiddenFields: [],
requiredFields: [
'first_name',
'last_name',
'email'
]
'email',
],
},
organisation: {
hiddenFields: [],
requiredFields: [
'name',
'type'
]
}
'type',
],
},
}
};
......@@ -2,6 +2,8 @@ import Vue from 'vue';
import VueRouter from 'vue-router';
import i18n from '@/i18n';
import config from '../../public/config.js';
Vue.use(VueRouter);
function normalizePathname(pathname) {
......@@ -18,24 +20,24 @@ const routes = [
{
path: '/:locale',
component: () => import('@/views/Base.vue'),
beforeEnter: (to, from, next) => {
beforeEnter: (to, from, next) => {
const locale = to.params.locale;
const supported_locales = process.env.VUE_APP_I18N_SUPPORTED_LOCALE.split(',');
if (!locale) {
return next({
path: `${process.env.VUE_APP_I18N_DEFAULT_LOCALE}${to.path.endsWith('/') ? to.path : normalizePathname(to.path)}`,
query: to.query
});
}
if (locale && locale.length !== 2) {
return next({
path: `${process.env.VUE_APP_I18N_DEFAULT_LOCALE}${to.path.endsWith('/') ? to.path : normalizePathname(to.path)}`,
query: to.query
});
}
if (locale && !supported_locales.includes(locale)) {
return next({
path:
......@@ -75,6 +77,13 @@ const routes = [
path: 'signup',
name: 'SignUp',
component: () => import('@/views/SignUp.vue'),
beforeEnter: (to, from, next) => {
if (config.forms.signup.disabled) {
return next({ path: 'not-found/' });
} else {
return next();
}
}
},
{
path: 'terms-of-use',
......
......@@ -74,6 +74,7 @@
<div class="form-row">
<div class="btn-group-vertical">
<router-link
v-if="!$config.forms.signup.disabled"
:to="{ name: 'SignUp' }"
custom
>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment