feat(auth): disable public registration while keeping member login

This commit is contained in:
2026-02-13 08:15:45 +08:00
parent 7095be82d5
commit 5c3866446c
5 changed files with 24 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
REGISTRATION_ENABLED=false
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null

View File

@@ -112,4 +112,15 @@ return [
'password_timeout' => 10800, 'password_timeout' => 10800,
/*
|--------------------------------------------------------------------------
| Public Registration Toggle
|--------------------------------------------------------------------------
|
| Control whether public-facing registration routes are exposed.
| Keep this disabled when onboarding is invite/import only.
|
*/
'registration_enabled' => env('REGISTRATION_ENABLED', false),
]; ];

View File

@@ -145,13 +145,12 @@
</p> </p>
</div> </div>
<div class="card" style="background:rgba(15,23,42,0.9);"> <div class="card" style="background:rgba(15,23,42,0.9);">
<h3>會員資格及註冊流程</h3> <h3>會員資格及使用說明</h3>
<p style="margin-top:8px;"> <p style="margin-top:8px;">
本系統目前提供會員登入使用。<br> 本系統目前提供會員登入使用。<br>
根據本會章程 (ToDo, 章程連結, ),本會會員目標為......(待補完) <br> 根據本會章程 (ToDo, 章程連結, ),本會會員目標為......(待補完) <br>
註冊流程為申請本站帳號,<br> 目前暫停開放新註冊,僅供既有會員登入確認資料。<br>
並繳費完成,<br> 若需申請入會,請先聯繫協會,由幹部協助建立帳號與後續審核流程。<br>
提交繳交證明後,經由本會幹部審核通過後,方可成為正式會員。<br>
</p> </p>
</div> </div>
</section> </section>

View File

@@ -12,10 +12,12 @@ use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::middleware('guest')->group(function () { Route::middleware('guest')->group(function () {
if (config('auth.registration_enabled')) {
Route::get('register', [RegisteredUserController::class, 'create']) Route::get('register', [RegisteredUserController::class, 'create'])
->name('register'); ->name('register');
Route::post('register', [RegisteredUserController::class, 'store']); Route::post('register', [RegisteredUserController::class, 'store']);
}
Route::get('login', [AuthenticatedSessionController::class, 'create']) Route::get('login', [AuthenticatedSessionController::class, 'create'])
->name('login'); ->name('login');

View File

@@ -79,8 +79,10 @@ Route::get('/dashboard', function () {
})->middleware(['auth', 'verified'])->name('dashboard'); })->middleware(['auth', 'verified'])->name('dashboard');
// Public Member Registration Routes // Public Member Registration Routes
Route::get('/register/member', [PublicMemberRegistrationController::class, 'create'])->name('register.member'); if (config('auth.registration_enabled')) {
Route::post('/register/member', [PublicMemberRegistrationController::class, 'store'])->name('register.member.store'); Route::get('/register/member', [PublicMemberRegistrationController::class, 'create'])->name('register.member');
Route::post('/register/member', [PublicMemberRegistrationController::class, 'store'])->name('register.member.store');
}
// Public Document Routes (accessible with optional auth) // Public Document Routes (accessible with optional auth)
Route::get('/documents', [PublicDocumentController::class, 'index'])->name('documents.index'); Route::get('/documents', [PublicDocumentController::class, 'index'])->name('documents.index');