Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 8d1199c

Browse files
author
Holger Lösken
committed
Fix enable/disable, fix improper config publish
- [Fix] Enabling/disabling of the magic link usage was not saved correctly - [Fix] Publishing of config file
1 parent 9e9cda9 commit 8d1199c

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

public/js/statamic-magiclink.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/components/SettingsComponent.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<form-group
66
class="toggle-fieldtype"
77
fieldtype="toggle"
8-
handle="isEnabled"
8+
handle="enabled"
99
:display="__('magiclink::cp.settings.ml_enabled')"
1010
:instructions="__('magiclink::cp.settings.ml_enabled_instructions')"
11-
v-model="isEnabled"
11+
v-model="enabled"
1212
/>
1313

1414
<form-group
15-
handle="expireTime"
1615
class="border-b"
16+
handle="expireTime"
1717
:display="__('magiclink::cp.settings.ml_expire_time')"
1818
:errors="errors.expireTime"
1919
:instructions="__('magiclink::cp.settings.ml_expire_time_instructions')"
@@ -38,7 +38,7 @@
3838
type: Number,
3939
required: true,
4040
},
41-
initialIsEnabled: {
41+
initialEnabled: {
4242
type: Boolean,
4343
required: true,
4444
},
@@ -56,7 +56,7 @@
5656
return {
5757
error: null,
5858
errors: {},
59-
isEnabled: this.initialIsEnabled,
59+
enabled: this.initialEnabled,
6060
expireTime: this.initialExpireTime,
6161
}
6262
},
@@ -68,7 +68,7 @@
6868
6969
payload() {
7070
return {
71-
isEnabled: this.isEnabled,
71+
enabled: this.enabled,
7272
expireTime: this.expireTime,
7373
}
7474
},

resources/views/cp/settings/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
method="patch"
1414
action="{{ cp_route('magiclink.update') }}"
1515
index-url="{{ cp_route('dashboard') }}"
16-
initial-is-enabled="{{ Statamic\Support\Str::bool($isEnabled) }}"
16+
:initial-enabled="{{ Statamic\Support\Str::bool($enabled) }}"
1717
initial-expire-time="{{ $expireTime }}"
1818
></magiclink-settings>
1919

src/Http/Controllers/Cp/SettingsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function update(Request $request)
2828
$this->authorize('view settings');
2929

3030
$request->validate([
31-
'isEnabled' => ['required', 'boolean'],
31+
'enabled' => ['required', 'boolean'],
3232
'expireTime' => ['required', 'numeric'],
3333
]);
3434

src/Repositories/SettingsRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(Filesystem $files)
2222
$this->path = storage_path('statamic-magiclink/settings.yaml');
2323

2424
$this->defaultValues = [
25-
self::IS_ENABLED_KEY => true,
25+
self::IS_ENABLED_KEY => false,
2626
self::EXPIRE_TIME_KEY => config('statamic-magiclink.expire_time'),
2727
];
2828
}

src/ServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function boot() {
5656

5757
public function register()
5858
{
59+
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'statamic-magiclink');
60+
5961
/*
6062
* Swap login controller to be able to inject custom template.
6163
*/

0 commit comments

Comments
 (0)