diff --git a/app/Http/Controllers/ESign/EsignPublicController.php b/app/Http/Controllers/ESign/EsignPublicController.php index eb5a35a4..7dffc204 100644 --- a/app/Http/Controllers/ESign/EsignPublicController.php +++ b/app/Http/Controllers/ESign/EsignPublicController.php @@ -22,6 +22,30 @@ class EsignPublicController extends Controller { + // ─── 전자계약 서명 확인 (전화번호 기반) ─── + + public function verifyPhone(Request $request) + { + $phone = preg_replace('/[^0-9]/', '', $request->input('phone', '')); + + if (strlen($phone) < 10) { + return back()->withErrors(['phone' => '올바른 전화번호를 입력해 주세요.']); + } + + $signer = EsignSigner::withoutGlobalScopes() + ->where('phone', $phone) + ->whereIn('status', ['pending', 'notified']) + ->whereHas('contract', fn ($q) => $q->where('status', 'pending')) + ->latest('created_at') + ->first(); + + if (! $signer) { + return back()->withErrors(['phone' => '대기 중인 전자계약이 없습니다.']); + } + + return redirect("/esign/sign/{$signer->access_token}"); + } + // ─── 화면 라우트 ─── public function auth(string $token): View diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 5a29e2a5..685b46ce 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -80,6 +80,34 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin + + {{-- 전자계약 서명 바로가기 --}} +
+

전자계약 서명하기

+

카카오톡으로 서명 요청을 받으셨나요? 전화번호를 입력하세요.

+ + @if ($errors->has('phone')) +
+ + + + {{ $errors->first('phone') }} +
+ @endif + +
+ @csrf + + +
+
diff --git a/routes/web.php b/routes/web.php index 00d05035..b8247417 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1583,6 +1583,9 @@ | SAM E-Sign Public Routes (인증 불필요 - 서명자용) |-------------------------------------------------------------------------- */ +// 전자계약 전화번호 확인 (공개, 비인증) +Route::post('/esign/verify-phone', [EsignPublicController::class, 'verifyPhone'])->name('esign.verify-phone'); + Route::prefix('esign/sign')->group(function () { // 화면 라우트 Route::get('/{token}', [EsignPublicController::class, 'auth'])->name('esign.sign.auth');