Skip to content

Commit

Permalink
Login-Link, User Session and some improvements to User Device (#516)
Browse files Browse the repository at this point in the history
Co-authored-by: adrolli <[email protected]>
  • Loading branch information
adrolli and adrolli authored Apr 26, 2024
1 parent 729daa0 commit 8652860
Show file tree
Hide file tree
Showing 61 changed files with 1,884 additions and 17 deletions.
9 changes: 3 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/monorepo-split-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- jobs
- user
- user-device
- user-session
- sync
- audit

Expand Down
4 changes: 4 additions & 0 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public function panel(Panel $panel): Panel

\Moox\UserDevice\UserDevicePlugin::make(),

\Moox\LoginLink\LoginLinkPlugin::make(),

\Moox\UserSession\UserSessionPlugin::make(),

]);
}
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"moox/sync": "*",
"moox/user": "*",
"moox/user-device": "*",
"moox/login-link": "*",
"moox/user-session": "*",
"wikimedia/composer-merge-plugin": "^2.1"
},
"require-dev": {
Expand Down
9 changes: 9 additions & 0 deletions config/login-link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'navigation_sort' => 2001,
'user_models' => [
'App Users' => \App\Models\User::class,
'Moox Users' => \Moox\User\Models\User::class,
],
];
34 changes: 34 additions & 0 deletions database/migrations/2024_04_25_131401_create_login_links_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('login_links', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->nullable;
$table->string('user_type')->nullable;
$table->string('email')->index();
$table->string('token')->index()->nullable;
$table->dateTime('expires_at');
$table->string('user_agent')->nullable();
$table->ipAddress('ip_address')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('login-link');
}
};
13 changes: 13 additions & 0 deletions packages/login-link/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [mooxphp]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
49 changes: 49 additions & 0 deletions packages/login-link/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Environment
.env
.env.backup

# Composer
/vendor
composer.lock
auth.json

# NPM / Node
/node_modules
npm-debug.log
package-lock.json

# Laravel
/public/hot
/public/storage
/storage/*.key

# PHPUnit
.phpunit.result.cache
phpunit.xml

# Yarn
yarn-error.log

# PHPStan
/build
phpstan.neon

# Testbench
testbench.yaml

# PHP CS Fixer
.php-cs-fixer.cache

# Homestead
Homestead.json
Homestead.yaml

# IDEs
/.idea
/.vscode

# MacOS
.DS_Store

# Windows
Thumbs.db
1 change: 1 addition & 0 deletions packages/login-link/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
13 changes: 13 additions & 0 deletions packages/login-link/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [mooxphp]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
21 changes: 21 additions & 0 deletions packages/login-link/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Moox <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
53 changes: 53 additions & 0 deletions packages/login-link/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
![Moox LoginLink](https://github.com/mooxphp/moox/raw/main/art/banner/login-link.jpg)

# Moox LoginLink

This is my package login-link

## Quick Installation

These two commmands are all you need to install the package:

```bash
composer require moox/login-link
php artisan mooxlogin-link:install
```

Curious what the install command does? See manual installation below.

## What it does

<!--whatdoes-->

Here are some things missing, like an overview with screenshots about this package, or simply a link to the package's docs.

<!--/whatdoes-->

## Manual Installation

Instead of using the install-command `php artisan mooxlogin-link:install` you are able to install this package manually step by step:

```bash
// Publish and run the migrations:
php artisan vendor:publish --tag="login-link-migrations"
php artisan migrate

// Publish the config file with:
php artisan vendor:publish --tag="login-link-config"
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Security Vulnerabilities

Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities.

## Credits

- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
13 changes: 13 additions & 0 deletions packages/login-link/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

We maintain the current version of `Moox LoginLink` actively.

Do not expect security fixes for older versions.

## Reporting a Vulnerability

If you find any security-related bug, please report it to [email protected].

Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things.
36 changes: 36 additions & 0 deletions packages/login-link/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "moox/login-link",
"description": "This is my package login-link",
"keywords": [
"Laravel",
"Filament",
"Filament plugin",
"Laravel package"
],
"homepage": "https://moox.org/",
"license": "MIT",
"authors": [
{
"name": "Moox Developer",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"moox/core": "*"
},
"autoload": {
"psr-4": {
"Moox\\LoginLink\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Moox\\LoginLink\\LoginLinkServiceProvider"
]
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
10 changes: 10 additions & 0 deletions packages/login-link/config/login-link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
'navigation_sort' => 2001,
'expiration_time' => 24, // hours
'user_models' => [
'App Users' => \App\Models\User::class,
'Moox Users' => \Moox\User\Models\User::class,
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('login_links', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->nullable;
$table->string('user_type');
$table->string('email')->index();
$table->string('token')->index()->nullable;
$table->dateTime('expires_at');
$table->string('user_agent')->nullable();
$table->ipAddress('ip_address')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void

{
Schema::dropIfExists('login-link');
}
};
20 changes: 20 additions & 0 deletions packages/login-link/resources/lang/de/translations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

return [
'single' => 'Login Link',
'plural' => 'Login Links',
'breadcrumb' => 'Login Link',
'title' => 'Login Link',
'navigation_label' => 'Login Link',
'navigation_group' => 'Moox User',
'totalone' => 'Login Links Pending',
'totaltwo' => 'Login Links Used',
'totalthree' => 'Login Links Invalid',
'token' => 'Token',
'expires_at' => 'Expires at',
'email' => 'E-Mail',
'user_agent' => 'User Agent',
'ip_address' => 'IP-Adresse',
'user_type' => 'User Model',
'user_id' => 'User ID',
];
21 changes: 21 additions & 0 deletions packages/login-link/resources/lang/en/translations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

return [
'single' => 'Login Link',
'plural' => 'Login Links',
'breadcrumb' => 'Login Link',
'title' => 'Login Link',
'navigation_label' => 'Login Link',
'navigation_group' => 'Moox User',
'totalone' => 'Login Links Pending',
'totaltwo' => 'Login Links Used',
'totalthree' => 'Login Links Invalid',
'token' => 'Token',
'expires_at' => 'Expires at',
'email' => 'E-Mail',
'user_agent' => 'User Agent',
'ip_address' => 'IP-Adresse',
'user_id' => 'User ID',
'user_type' => 'User Model',
'username' => 'Username',
];
Loading

0 comments on commit 8652860

Please sign in to comment.