feat: [esign] 로그인 페이지에 전자계약 서명 바로가기 추가

- 알림톡 버튼 클릭 시 전화번호 입력으로 서명 페이지 이동
- 바로빌 템플릿 URL 변경 전 임시 우회 방법
This commit is contained in:
김보곤
2026-02-24 19:03:24 +09:00
parent 504f59dc99
commit 13567217a7
3 changed files with 55 additions and 0 deletions

View File

@@ -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

View File

@@ -80,6 +80,34 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin
</button>
</form>
</div>
{{-- 전자계약 서명 바로가기 --}}
<div class="w-96 bg-white rounded-lg shadow-xl p-6 mt-4">
<h3 class="text-sm font-semibold text-gray-700 mb-3">전자계약 서명하기</h3>
<p class="text-xs text-gray-500 mb-3">카카오톡으로 서명 요청을 받으셨나요? 전화번호를 입력하세요.</p>
@if ($errors->has('phone'))
<div class="flex items-center gap-2 p-3 mb-3 bg-red-50 border border-red-200 text-red-700 rounded-lg text-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>{{ $errors->first('phone') }}</span>
</div>
@endif
<form method="POST" action="{{ route('esign.verify-phone') }}" class="flex gap-2">
@csrf
<input
type="tel"
name="phone"
placeholder="01012345678"
class="flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 transition-colors whitespace-nowrap">
확인
</button>
</form>
</div>
</div>
</div>
</body>

View File

@@ -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');