Hiding login and signup buttons when disabled.

This commit is contained in:
DebaucheryLibrarian 2024-03-17 06:00:18 +01:00
parent e7107c33c2
commit f8a6e67483
3 changed files with 11 additions and 1 deletions

View File

@ -115,7 +115,7 @@
</VDropdown> </VDropdown>
<div <div
v-else v-else-if="allowLogin"
class="userpanel" class="userpanel"
> >
<a <a
@ -138,6 +138,7 @@ const pageContext = inject('pageContext');
const user = pageContext.user; const user = pageContext.user;
const query = ref(pageContext.urlParsed.search.q || ''); const query = ref(pageContext.urlParsed.search.q || '');
const allowLogin = pageContext.env.allowLogin;
const searchFocused = ref(false); const searchFocused = ref(false);
const activePage = computed(() => pageContext.urlParsed.pathname.split('/')[1]); const activePage = computed(() => pageContext.urlParsed.pathname.split('/')[1]);
@ -246,6 +247,11 @@ async function logout() {
cursor: pointer; cursor: pointer;
} }
} }
&:last-child {
/* login disabled */
margin-right: 1rem;
}
} }
.userpanel { .userpanel {

View File

@ -72,6 +72,7 @@
<button class="button button-submit">Log in</button> <button class="button button-submit">Log in</button>
<a <a
v-if="allowSignup"
href="/signup" href="/signup"
class="link" class="link"
>Create an account</a> >Create an account</a>
@ -87,6 +88,7 @@ import navigate from '#/src/navigate.js';
const pageContext = inject('pageContext'); const pageContext = inject('pageContext');
const user = pageContext.user; const user = pageContext.user;
const allowSignup = pageContext.env.allowSignup;
const username = ref(''); const username = ref('');
const password = ref(''); const password = ref('');

View File

@ -146,6 +146,8 @@ export default async function initServer() {
primaryStash: req.user.primaryStash, primaryStash: req.user.primaryStash,
}, },
env: { env: {
allowLogin: config.auth.login,
allowSignup: config.auth.signup,
maxAggregateSize: config.database.manticore.maxAggregateSize, maxAggregateSize: config.database.manticore.maxAggregateSize,
}, },
}; };