Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"require-dev": {
"nunomaduro/larastan": "^2.6",
"orchestra/testbench": "^7.32 | ^8.12",
"orchestra/testbench": "^7.39.0",
"phpunit/phpunit": "^9.5"
},
"config": {
Expand Down
16 changes: 8 additions & 8 deletions resources/lang/de/cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

return [
'settings' => [
'headline' => 'MagicLink',
'configure_your_needs' => 'Passe MagicLink nach deinen Wünschen an',
'ml_enabled' => 'MagicLink aktivieren?',
'ml_enabled_instructions' => 'Aktiviere oder deaktiviere die Nutzung von MagicLinks',
'ml_expire_time' => 'Ablaufzeit',
'headline' => 'MagicLink',
'configure_your_needs' => 'Passe MagicLink nach deinen Wünschen an',
'ml_enabled' => 'MagicLink aktivieren?',
'ml_enabled_instructions' => 'Aktiviere oder deaktiviere die Nutzung von MagicLinks',
'ml_expire_time' => 'Ablaufzeit',
'ml_expire_time_instructions' => 'Laufzeit des Links, nachdem er verfällt. Standard sind 30 Minuten.',
'updated_successfully' => 'Einstellungen erfolgreich aktualisiert.',
'updated_successfully' => 'Einstellungen erfolgreich aktualisiert.',
],
'permissions' => [
'settings' => 'MagicLink Einstellung',
'view_settings' => 'Einstellungen ansehen',
'settings' => 'MagicLink Einstellung',
'view_settings' => 'Einstellungen ansehen',
'view_settings_description' => 'Zugriff, um Einstellungen anzusehen.',
],
'email' => [
Expand Down
10 changes: 5 additions & 5 deletions resources/lang/de/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

return [
'address_exists_then_email' => 'Wenn die E-Mail-Adresse bei uns registriert ist, solltest du eine E-Mail bekommen haben.',
'back_to_classic_login' => 'Zurück zum klassischen Login?',
'email_address' => 'E-Mail-Adresse',
'login_magic_link' => 'Magic Link senden',
'address_exists_then_email' => 'Wenn die E-Mail-Adresse bei uns registriert ist, solltest du eine E-Mail bekommen haben.',
'back_to_classic_login' => 'Zurück zum klassischen Login?',
'email_address' => 'E-Mail-Adresse',
'login_magic_link' => 'Magic Link senden',
'magic_link_signature_invalid' => 'Der Magic Link ist ungültig. Bitte fordere einen neuen Link an.',
'unable_to_send' => 'Senden des Links nicht möglich.',
'unable_to_send' => 'Senden des Links nicht möglich.',
];
22 changes: 11 additions & 11 deletions resources/lang/en/cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
'redirect_to' => 'Redirect to',
],
'settings' => [
'headline' => 'MagicLink',
'configure_your_needs' => 'Configure MagicLink after your needs.',
'ml_enabled' => 'MagicLink enabled?',
'ml_enabled_instructions' => 'Activate or deactivate the usage of magic links.',
'ml_expire_time' => 'Expire time',
'headline' => 'MagicLink',
'configure_your_needs' => 'Configure MagicLink after your needs.',
'ml_enabled' => 'MagicLink enabled?',
'ml_enabled_instructions' => 'Activate or deactivate the usage of magic links.',
'ml_expire_time' => 'Expire time',
'ml_expire_time_instructions' => 'Time the login link is valid. Default is 30 minutes.',
'ml_allowed_addresses' => 'Allowed addresses',
'ml_allowed_addresses_instructions' => 'Allowed addresses to request a magic link for viewing protected content. Enter one address in each field.',
'ml_allowed_domains' => 'Allowed domains',
'ml_allowed_domains_instructions' => 'Allowed domains to request a magic link for. _Example:_ example.com',
'settings' => 'Settings',
'updated_successfully' => 'Settings updated successfully.',
'settings' => 'Settings',
'updated_successfully' => 'Settings updated successfully.',
],
'permissions' => [
'settings' => 'MagicLink Settings',
'view_links' => 'View links',
'view_links_description' => 'Grants access to see magic links',
'view_settings' => 'View settings',
'settings' => 'MagicLink Settings',
'view_links' => 'View links',
'view_links_description' => 'Grants access to see magic links',
'view_settings' => 'View settings',
'view_settings_description' => 'Grants access to see settings',
],
'email' => [
Expand Down
10 changes: 5 additions & 5 deletions resources/lang/en/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

return [
'address_exists_then_email' => 'If there exists an account with this email address, you should have received a message.',
'back_to_classic_login' => 'Back to classic login page?',
'email_address' => 'Email',
'login_magic_link' => 'Send Magic Link',
'address_exists_then_email' => 'If there exists an account with this email address, you should have received a message.',
'back_to_classic_login' => 'Back to classic login page?',
'email_address' => 'Email',
'login_magic_link' => 'Send Magic Link',
'magic_link_signature_invalid' => 'Your MagicLink signature seems invalid. Please request a new link.',
'unable_to_send' => 'Unable to send link.',
'unable_to_send' => 'Unable to send link.',
];
8 changes: 4 additions & 4 deletions src/Http/Controllers/Cp/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public function showLoginForm(Request $request)
}

$data = [
'title' => __('Log in'),
'oauth' => $enabled = OAuth::enabled(),
'title' => __('Log in'),
'oauth' => $enabled = OAuth::enabled(),
'providers' => $enabled ? OAuth::providers() : [],
'referer' => $this->getReferrer(),
'hasError' => $this->hasError(),
'referer' => $this->getReferrer(),
'hasError' => $this->hasError(),
];

$view = view('magiclink::auth.login', $data);
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Cp/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function update(Request $request)
$this->authorize('view magiclink settings');

$request->validate([
'enabled' => ['required', 'boolean'],
'enabled' => ['required', 'boolean'],
'expireTime' => ['required', 'numeric'],
'allowedAddresses' => ['present', 'array'],
'allowedAddresses.*' => ['sometimes', 'email'],
Expand Down
2 changes: 1 addition & 1 deletion src/MagicLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function generate(): self
'magiclink.login',
$this->expireTime,
[
'hash' => $this->generateHash(),
'hash' => $this->generateHash(),
'user_email' => $this->user->email(),
]
);
Expand Down
4 changes: 2 additions & 2 deletions src/MagicLinkManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function generate(): MagicLink
$link = $this->magicLink->generate();

$payload[$this->user->email()] = [
'email' => $this->user->email(),
'email' => $this->user->email(),
'expire_time' => $this->magicLink->getExpireTime()->timestamp,
'hash' => $link->getHash(),
'hash' => $link->getHash(),
'redirect_to' => $this->magicLink->getRedirectTo(),
];

Expand Down
2 changes: 1 addition & 1 deletion src/Mail/MagicLink/LinkInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function build()
{
return $this->subject(config('app.name').' - '.__('magiclink::cp.email.new_link_subject'))
->markdown('magiclink::emails.new-login-link', [
'userName' => $this->user->name,
'userName' => $this->user->name,
'magicLink' => $this->magicLink->getLink(),
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/SettingsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(Filesystem $files)
$this->path = storage_path('statamic-magiclink/settings.yaml');

$this->defaultValues = [
self::IS_ENABLED_KEY => false,
self::IS_ENABLED_KEY => false,
self::EXPIRE_TIME_KEY => config('statamic-magiclink.expire_time'),
self::ALLOWED_ADDRESSES => [],
self::ALLOWED_DOMAINS => [],
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
final class ServiceProvider extends AddonServiceProvider
{
protected $routes = [
'cp' => __DIR__.'/../routes/cp.php',
'cp' => __DIR__.'/../routes/cp.php',
'web' => __DIR__.'/../routes/web.php',
];

Expand Down
14 changes: 7 additions & 7 deletions tests/CP/Settings/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function cannot_see_settings_with_no_permissions(): void
public function can_update_settings_without_error(): void
{
$payload = [
'enabled' => true,
'enabled' => true,
'expireTime' => 999,
'allowedAddresses' => [],
'allowedDomains' => [],
Expand All @@ -52,7 +52,7 @@ public function can_update_settings_without_error(): void
public function cannot_update_settings_with_all_errors(): void
{
$payload = [
'enabled' => 123,
'enabled' => 123,
'expireTime' => 'test',
'allowedAddresses' => ['wrong'],
'allowedDomains' => [],
Expand All @@ -67,7 +67,7 @@ public function cannot_update_settings_with_all_errors(): void
public function cannot_update_settings_with_enabled_errors(): void
{
$payload = [
'enabled' => 123,
'enabled' => 123,
'expireTime' => 30,
'allowedAddresses' => [],
'allowedDomains' => [],
Expand All @@ -88,7 +88,7 @@ public function cannot_update_settings_with_enabled_errors(): void
public function cannot_update_settings_with_expire_time_errors(): void
{
$payload = [
'enabled' => true,
'enabled' => true,
'expireTime' => 'test',
'allowedAddresses' => [],
'allowedDomains' => [],
Expand All @@ -111,7 +111,7 @@ public function can_set_enabled_to_true_false(): void
$repository = $this->app->make(SettingsRepository::class);

$payload = [
'enabled' => true,
'enabled' => true,
'expireTime' => 300,
'allowedAddresses' => [],
'allowedDomains' => [],
Expand All @@ -121,7 +121,7 @@ public function can_set_enabled_to_true_false(): void
$this->assertTrue($repository->isEnabled());

$payload = [
'enabled' => false,
'enabled' => false,
'expireTime' => 300,
'allowedAddresses' => [],
'allowedDomains' => [],
Expand All @@ -137,7 +137,7 @@ public function can_set_expireTime_to_values(): void
$repository = $this->app->make(SettingsRepository::class);

$payload = [
'enabled' => true,
'enabled' => true,
'expireTime' => 300,
'allowedAddresses' => [],
'allowedDomains' => [],
Expand Down
2 changes: 1 addition & 1 deletion tests/MagicLink/MagicLinkFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function can_request_link_for_non_existing_but_allowed_domain_user(): voi
$this->signInAdmin();

$payload = [
'enabled' => true,
'enabled' => true,
'expireTime' => 999,
'allowedAddresses' => [],
'allowedDomains' => ['larifari.test'],
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function getEnvironmentSetUp($app)

$app->make(Manifest::class)->manifest = [
'codedge/statamic-magiclink' => [
'id' => 'codedge/statamic-magiclink',
'id' => 'codedge/statamic-magiclink',
'namespace' => 'Codedge\\MagicLink\\',
],
];
Expand Down