mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 06:49:37 +02:00
Custom registration disable message
This commit is contained in:
parent
824fbcb42f
commit
f237f480df
5 changed files with 7 additions and 5 deletions
|
@ -169,6 +169,7 @@ REST_AUTH = {
|
||||||
}
|
}
|
||||||
|
|
||||||
DISABLE_REGISTRATION = getenv('DISABLE_REGISTRATION', 'False') == 'True'
|
DISABLE_REGISTRATION = getenv('DISABLE_REGISTRATION', 'False') == 'True'
|
||||||
|
DISABLE_REGISTRATION_MESSAGE = getenv('DISABLE_REGISTRATION_MESSAGE', 'Registration is disabled. Please contact the administrator if you need an account.')
|
||||||
|
|
||||||
STORAGES = {
|
STORAGES = {
|
||||||
"staticfiles": {
|
"staticfiles": {
|
||||||
|
|
|
@ -40,5 +40,5 @@ class IsRegistrationDisabled(APIView):
|
||||||
operation_description="Check if registration is disabled."
|
operation_description="Check if registration is disabled."
|
||||||
)
|
)
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
return Response({"is_disabled": settings.DISABLE_REGISTRATION}, status=status.HTTP_200_OK)
|
return Response({"is_disabled": settings.DISABLE_REGISTRATION, "message": settings.DISABLE_REGISTRATION_MESSAGE}, status=status.HTTP_200_OK)
|
||||||
|
|
|
@ -9,4 +9,6 @@ To disable registration, you can set the following variable in your docker-compo
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
- DISABLE_REGISTRATION=True
|
- DISABLE_REGISTRATION=True
|
||||||
|
# OPTIONAL: Set the message to display when registration is disabled
|
||||||
|
- DISABLE_REGISTRATION_MESSAGE='Registration is disabled for this instance of AdventureLog.'
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,7 +13,8 @@ export const load: PageServerLoad = async (event) => {
|
||||||
console.log(is_disabled_json);
|
console.log(is_disabled_json);
|
||||||
if (is_disabled_json.is_disabled) {
|
if (is_disabled_json.is_disabled) {
|
||||||
return {
|
return {
|
||||||
is_disabled: true
|
is_disabled: true,
|
||||||
|
message: is_disabled_json.message
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -98,9 +98,7 @@
|
||||||
<div class="card card-compact w-96 bg-base-100 shadow-xl p-6 mt-4 mb-4">
|
<div class="card card-compact w-96 bg-base-100 shadow-xl p-6 mt-4 mb-4">
|
||||||
<article class="text-center">
|
<article class="text-center">
|
||||||
<h1 class="text-4xl font-extrabold mb-6">Signup is disabled for this server.</h1>
|
<h1 class="text-4xl font-extrabold mb-6">Signup is disabled for this server.</h1>
|
||||||
<p>Please contact the server administrator if you think this is an error.</p>
|
<p>{data.message}</p>
|
||||||
<br />
|
|
||||||
<p>If you are the administrator, users can be registered via the admin site.</p>
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{#if errors.message}
|
{#if errors.message}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue