DEV Community

JOHN MWACHARO
JOHN MWACHARO

Posted on

🔐 How to Disable User Registration in a Complete Laravel + Inertia System

In modern web applications—especially internal systems like courier management platforms, ERPs, and CRMs—user registration should not be open to the public. Instead, accounts should be created by system admins. This guide walks you through disabling user registration completely in a Laravel + Jetstream + Inertia + Vue stack.

✅ Why Disable Registration?
In enterprise systems like:

Courier company dashboards

Internal order management apps

Logistics and HR platforms

…it’s risky and unnecessary to allow public user self-registration. Allowing users to sign up from outside could lead to:

Unauthorized access

Security holes

Data leaks

Increased attack surface

Instead, users should be created internally by authorized admins.

⚙️ Tech Stack in Use
This guide applies to Laravel projects using:

Jetstream (with Inertia + Vue)

Laravel Fortify for authentication

Vue 3 + TailwindCSS frontend

🔧 Step-by-Step: Disabling User Registration

  1. 🧱 Disable Fortify Registration Feature Open config/fortify.php and remove or comment the registration feature:

'features' => [
// Features::registration(), ← Disable this
Features::resetPasswords(),
Features::emailVerification(),
],
This prevents Laravel Fortify from registering the /register route.

  1. 🚫 Block Any Remaining /register Route Even if Fortify is disabled, it's good practice to explicitly block the route in case someone tries accessing it manually.

Add this to the bottom of your routes/web.php:

Route::any('/register', function () {
abort(403, 'User registration is disabled.');
});
This will return a 403 Forbidden response to any HTTP method trying to access /register.

  1. 🧼 Remove the Register Page from Vue Frontend In your Vue Inertia project, locate:

resources/js/Pages/Auth/Register.vue
Option A: Delete the File
You can simply remove it:

rm resources/js/Pages/Auth/Register.vue
Option B: Redirect Inside the Component
If you prefer to leave the file, use this instead:

import { onMounted } from 'vue' import { router } from '@inertiajs/vue3' onMounted(() => { router.visit(route('home')) })


Redirecting...

This redirects users to the welcome page if they somehow navigate to /register.

  1. ✂️ Remove Registration Links in the UI Anywhere you have:

Register
Remove it or wrap it in a condition that always evaluates to false:


Register

  1. 🧪 Test With Curl Try this to ensure registration is blocked:

curl -X POST http://127.0.0.1:8000/register \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name":"Test","email":"test@mail.com","password":"secret123","password_confirmation":"secret123"}'
✅ Expected: You should receive a 403 Forbidden or 404 Not Found response.

✅ Bonus: How to Create Users Internally
To manually create users in your system:

use App\Models\User;
use Illuminate\Support\Facades\Hash;

User::create([
'name' => 'New Staff',
'email' => 'staff@example.com',
'password' => Hash::make('securePassword123'),
]);
You can also create a simple admin-only user management panel using standard CRUD logic.

🛡️ Final Thoughts
Disabling user self-registration in enterprise applications is a best practice for security and control. Laravel + Jetstream + Inertia gives you the flexibility to tailor authentication exactly how you need it.

With these steps, you ensure your system remains internal, secure, and professional.

Top comments (0)