-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up Filament + basic user management commands #231
Set up Filament + basic user management commands #231
Conversation
- Livewire v2.12.3 > v3.4.4 This is in preparation for a fresh install of Filament v3, which uses Livewire v3 under the hood. Most upgrades were automatic via `livewire:upgrade` with a couple of exceptions: - On HackgreenvilleTimeline.php:29, an old method "dispatchBrowserEvent()" was condensed into "dispatch()", and now takes args as named params instead of array keys. - Livewire's config was published so the `app.blade.php` could stay where it was. `@livewireStyles` and `@livewireScripts` also no longer need to be added manually. - Laravel v10.14.1 > v10.34.2 This is due to Livewire v3 using Illuminate\Support\Stringable::isUrl() indirectly when rendering Livewire components. This method did not exist in earlier versions of Laravel 10.
This will control whether a user can access the admin dashboard.
@zach2825 I think this was the leftover stuff from the old login system: The login form is still there and works... But it just takes you to the default Assuming Filament doesn't need these controllers and the related views, is it alright if I prune this stuff? I only see Laravel's default auth routes. |
Logo can be larger on login, but it'll be a specific size on the dashboard now.
Ok, I'm gonna take a break from pushing until I have all the commands done. Don't want to keep running GitHub Actions for small commits... |
6777aa0
to
5b2a1b9
Compare
@zach2825 since this PR pairs admin commands for user management w/ installing Filament, think it useful to at least include a user index and maybe "latest users" dashboard widget, or should those be separate PRs at this point? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added my feedback as a comment because everything works, just wanted to see what you thought about some of these other things...
For some reason, the admin/login route was not behaving correctly anymore despite no apparent changes to the lock files and having dependencies reinstalled. But upgrading filament seems to fix the issue.
composer/composer, affected by: CVE-2024-24821 phpseclib/phpseclib, affected by: CVE-2023-49316
Sorry I have not been paying much attention to this, but I like it =) |
@JSn1nj4 these seem to be some conflicts, can you go ahead and resolve them? |
@bogdankharchenko handled. Thanks! |
@zach2825 can you also take a peek into this? |
@bogdankharchenko I did, and had a little feedback its all been resolved and talked about 💯 thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
@JSn1nj4 it looks like we're just about ready to merge. One question, which we could address in another PR if it's worth doing. Is it possible to have the login form, or even all of the admin stuff, have routes/paths that's are not obvious and/or not publicly known. Using /admin/login would likely attract unnecessary hammering from bots over time. I'm accustom to changing at least the login form to something that isn't obvious. Bonus points if it's a path that's defined in a .env so even people reading this repo wouldn't know where to login or where the admin exists without being invited. As for deploying this to stage for testing, can you list any necessary or optional commands or steps? I'm assuming to run scripts/handle-deploy-update.sh and then are there any other artisan commands or other special things to run that aren't related to users? After that, I'm guessing the user-specific commands above, like On the email side, we don't have the .env configured to actually send email. The stage and production server runs sendmail/postfix locally to relay messages through Sendgrid. So, I think it would be pretty easy for me to edit the .env vars, like
Sendgrid was previously authorized to send emails on behalf of HG, but I think with the November transfer we lost some DNS records, so I just added them back. Which remains me we still need to move the DNS and transactional email system away from my control. (which is sort of bottlenecked by the HG Committee getting with RefactorGVL to get email MX setup, pass wd manager, and such) |
@allella on customizing the admin URL, I made it configurable via After a quick review, no extra setup steps should be needed. The deploy script as it currently is should result in everything being up. For email configuration, I believe you're correct. |
Oh, also just updated the deploy script (here cc4db3f) according to this section: |
@JSn1nj4 thanks. What do you think about adding the world "path" to the new dashboard config variable so it's more clear that it's not related to "root" permissions, but rather a root directory. Perhaps APP_DASHBOARD_ROOT_PATH Also, how about we added this variable to the .env.example too? |
@JSn1nj4 this was merged, but I did run into a Composer error because ext-intl wasn't installed and wasn't declared in the composer.json. Should we add ext-intl as a composer required package to possibly fail earlier in the install process during the dependency stage? It seemed like composer started doing things and only realized the extension was missing after the fact. I haven't tried to create any users yet, but the log in path is rendering. I'll share the admin path root in the Slack. |
@JSn1nj4 the email configuration is now setup on production and I created the first account as a test. Not that we need it right now, but are there any roles, or is every user an equal admin out of the gate? |
Accessing Filament Dashboard
Filament's default routes are:
admin
, but customizable viaAPP_DASHBOARD_ROOT
in.env
{dashboard-root}/login
{dashboard-root}/password-reset/request
Routes removed
The default auth routes pulled in with
Auth::routes()
. Since Filament has its own routes for login, logout, password resets etc., the default ones provided by Laravel are no longer needed.The old views and controllers specifically for those actions have also been removed.
Filament customizations
Filament's color customization is built around Tailwind's palette. Registering custom colors also works similarly, just using Filament's built-in tools.
For example:
Current customizations were done via the default AdminPanelProvider generated by Filament.
User management commands created
Laravel 10 generates custom commands with the
app:
prefix by default, so these new commands have that currently. We can adjust them if preferred.Create User command
Creates a new user account with a random password. If a user matching the email address exists, log an error instead.
A Password Reset email will also be generated.
Activate/Deactivate User commands
Activate or deactivate an existing user account. This controls whether users can log into the admin dashboard.
Note: Newly-created accounts are activated by default.
Password Reset command
Use this to reset the user's password to a new, strong password. Will ask to confirm before performing password reset.
The user will have to reset their password next time they want to sign in.
Delete User command
Delete an existing user. Will ask to confirm before deleting.
Considerations
Closes #229