Preparation for rolling out auth features
2024-05-07 15:52 WIB - Hendrik Lie
It is worth noting that the Auth features are coming. However we haven’t implemented every features we promised last time. We do however, solved the problem with auth user interface, and access to admin features if you are logged in. We have not implemented permissions feature for now though.
We have implemented:
- User register (currently limited to a certain IP address only);
- User login using username;
- Necessary pages for login, register, and dashboard;
- Limits route
/poststo registered users; - Limits routes beyond
/adminto registered users;
The following is a note for myself on preparation for migration:
- We will not use email for authentication, since we do not send or receive emails from this domain.
- Username will be used instead of email.
We will need to run the following after database migration on our server:
Migrate the database:
sail artisan migrateUpdate the database to generate usernames for existing users:
Update the database to also include latest pages config:
use Illuminate\Support\Facades\Hash; $pages = [ [ 'code' => 'dashboard', 'page_class' => 'nav-auth', 'page_title' => 'Dashboard', 'page_layout' => 'auth.dashboard', ], [ 'code' => 'register', 'page_class' => 'nav-auth', 'page_title' => 'Register', 'page_layout' => 'auth.register', ], [ 'code' => 'login', 'page_class' => 'nav-auth', 'page_title' => 'Login', 'page_layout' => 'auth.login', ], ]; foreach ($pages as $page) { PagesConfig::create($page); }
We need them because those setup are not present in production environment just yet. We had to recreate them. I think it is one of the problem when we decided that those should be a part of user-generated contents.