7.0 KiB
Registration System - Complete Test Guide
✅ System Status
Your Laravel server is RUNNING at: http://127.0.0.1:8000
All components are in place:
- ✅ POST /register route is registered
- ✅ RegisteredUserController with super-admin logic
- ✅ WelcomeEmail with verification button
- ✅ Email verification page
- ✅ All caches cleared and optimized
🧪 How to Test Registration
Step 1: Access Registration Page
Open your browser and go to:
http://127.0.0.1:8000/register
Step 2: Fill Out the Form
Enter the following information:
- Full Name: John Doe
- Email: john@example.com
- Password: password123
- Confirm Password: password123
- Mobile Number: 1234567890
- Country Code: +1 (United States)
- Gender: Male (M)
- Birthdate: 01/01/2000 (must be at least 10 years ago)
- Nationality: United States
Step 3: Submit the Form
Click the "REGISTER" button.
Step 4: Expected Behavior
After clicking Register, the following should happen:
-
User Created in Database:
- New user record created in
userstable - Password is hashed
- Mobile stored as JSON:
{"code": "+1", "number": "1234567890"}
- New user record created in
-
Super-Admin Role Assigned:
- First user gets
super-adminrole automatically - Record created in
user_rolestable
- First user gets
-
Welcome Email Sent:
- Email sent to the registered email address
- Contains "Verify Your Email" button
- Button links to verification URL
-
Browser Redirects:
- Redirects to:
http://127.0.0.1:8000/email/verify - Shows message: "Verify Your Email"
- Shows: "We've sent a verification link to your email address"
- Shows: "Resend Verification Email" button
- Redirects to:
📧 Email Configuration
Check Your Mail Driver
Run this command to see your current mail configuration:
php artisan tinker
Then type:
config('mail.mailer')
Common Mail Drivers:
1. Log Driver (Development - Default)
If using log driver, emails are written to:
storage/logs/laravel.log
To view the email:
type storage\logs\laravel.log
Look for the verification URL in the log file.
2. SMTP Driver (Production)
If using SMTP, check your email inbox for the welcome email.
3. Mailtrap (Testing)
If using Mailtrap, check your Mailtrap inbox.
To Change Mail Driver:
Edit your .env file:
For Development (Log to File):
MAIL_MAILER=log
MAIL_FROM_ADDRESS="noreply@example.com"
MAIL_FROM_NAME="${APP_NAME}"
For Gmail SMTP:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="noreply@example.com"
MAIL_FROM_NAME="${APP_NAME}"
After changing .env, restart the server:
.\restart-server.bat
🔍 Verification Process
Manual Email Verification (If Email Not Configured)
If you can't receive emails, you can manually verify the user:
- Get the verification URL from logs:
type storage\logs\laravel.log | findstr "verification"
- Or manually verify in database:
php artisan tinker
Then:
$user = App\Models\User::where('email', 'john@example.com')->first();
$user->markEmailAsVerified();
- Or visit the verification URL directly:
http://127.0.0.1:8000/email/verify/{user_id}/{hash}
🗄️ Database Verification
Check if User Was Created:
php artisan tinker
App\Models\User::latest()->first();
Check if Super-Admin Role Was Assigned:
$user = App\Models\User::latest()->first();
$user->roles;
Should show the super-admin role.
Or Use SQL:
-- Check latest user
SELECT * FROM users ORDER BY id DESC LIMIT 1;
-- Check user roles
SELECT u.id, u.email, u.full_name, r.name as role, r.slug
FROM users u
LEFT JOIN user_roles ur ON u.id = ur.user_id
LEFT JOIN roles r ON ur.role_id = r.id
ORDER BY u.id DESC
LIMIT 1;
🐛 Troubleshooting
Issue: Form Doesn't Submit (Nothing Happens)
Solution:
- Open browser console (F12)
- Look for JavaScript errors
- Check Network tab for failed requests
- Verify CSRF token is present in form
Issue: 404 Error on Submit
Solution:
.\restart-server.bat
Issue: 419 CSRF Token Mismatch
Solution:
- Clear browser cache (Ctrl+Shift+Delete)
- Hard refresh page (Ctrl+Shift+R)
- Try in incognito mode
Issue: Validation Errors
Common validation issues:
- Email already exists
- Password too short (min 8 characters)
- Passwords don't match
- Birthdate not at least 10 years ago
- Missing required fields
Issue: Email Not Sending
Check mail configuration:
php artisan tinker
// Test email sending
Mail::raw('Test email', function($message) {
$message->to('test@example.com')->subject('Test');
});
If using log driver, check:
type storage\logs\laravel.log
Issue: Can't Access Admin Panel After Registration
Verify super-admin role:
php artisan tinker
$user = App\Models\User::where('email', 'your@email.com')->first();
$user->isSuperAdmin(); // Should return true
If false, manually assign:
$user->assignRole('super-admin');
✅ Success Checklist
After registration, verify:
- User record created in database
- Password is hashed (not plain text)
- Mobile stored as JSON
- Super-admin role assigned (first user only)
- Welcome email sent (check logs if using log driver)
- Redirected to email verification page
- Verification page shows correct message
- Resend button works
- Verification link works (from email or logs)
- After verification, can login
- Can access
/adminroutes as super-admin
📝 Test Second User Registration
To verify that only the first user gets super-admin:
- Register a second user with different email
- Check database:
$user2 = App\Models\User::where('email', 'second@example.com')->first();
$user2->isSuperAdmin(); // Should return false
🎯 Next Steps After Successful Registration
- Verify Email: Click link in email or manually verify
- Login: Go to
/loginand login with credentials - Access Admin Panel: Go to
/admin(super-admin only) - Explore Platform: Go to
/exploreto see clubs - Create Family Members: Go to
/members/create
📞 Need Help?
If registration still doesn't work:
- Check server logs:
type storage\logs\laravel.log
-
Check browser console: Press F12 and look for errors
-
Verify routes:
php artisan route:list --path=register
- Test route directly:
php artisan tinker
$response = $this->post('/register', [
'full_name' => 'Test User',
'email' => 'test@test.com',
'password' => 'password123',
'password_confirmation' => 'password123',
'mobile_number' => '1234567890',
'country_code' => '+1',
'gender' => 'm',
'birthdate' => '2000-01-01',
'nationality' => 'United States'
]);
The registration system is fully functional and ready to use!