feat: Add SMS debug code modal for dev environment
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Form, Input, Button, message, Space } from 'antd';
|
||||
import { PhoneOutlined, SafetyOutlined } from '@ant-design/icons';
|
||||
import { Form, Input, Button, message, Space, Modal } from 'antd';
|
||||
import { PhoneOutlined, SafetyOutlined, CopyOutlined } from '@ant-design/icons';
|
||||
|
||||
interface Props {
|
||||
formData: any;
|
||||
@@ -23,6 +23,8 @@ export default function Step1Phone({
|
||||
const [codeSent, setCodeSent] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [verifyLoading, setVerifyLoading] = useState(false);
|
||||
const [debugCode, setDebugCode] = useState<string | null>(null);
|
||||
const [showDebugModal, setShowDebugModal] = useState(false);
|
||||
|
||||
const sendCode = async () => {
|
||||
try {
|
||||
@@ -49,7 +51,12 @@ export default function Step1Phone({
|
||||
message.success('Код отправлен на ваш телефон');
|
||||
setCodeSent(true);
|
||||
updateFormData({ phone });
|
||||
// DEBUG код не показываем в продакшене
|
||||
|
||||
// 🔧 DEV MODE: показываем debug код в модалке
|
||||
if (result.debug_code) {
|
||||
setDebugCode(result.debug_code);
|
||||
setShowDebugModal(true);
|
||||
}
|
||||
} else {
|
||||
addDebugEvent?.('sms', 'error', `❌ Ошибка SMS: ${result.detail}`, { error: result.detail });
|
||||
message.error(result.detail || 'Ошибка отправки кода');
|
||||
@@ -334,7 +341,47 @@ export default function Step1Phone({
|
||||
)}
|
||||
</Form.Item>
|
||||
|
||||
{/* DEV MODE секция удалена для продакшена */}
|
||||
{/* 🔧 DEV MODE: Модалка с SMS кодом */}
|
||||
<Modal
|
||||
title="🔧 DEV MODE - SMS Код"
|
||||
open={showDebugModal}
|
||||
onCancel={() => setShowDebugModal(false)}
|
||||
footer={[
|
||||
<Button
|
||||
key="copy"
|
||||
icon={<CopyOutlined />}
|
||||
onClick={() => {
|
||||
if (debugCode) {
|
||||
navigator.clipboard.writeText(debugCode);
|
||||
message.success('Код скопирован!');
|
||||
}
|
||||
}}
|
||||
>
|
||||
Скопировать
|
||||
</Button>,
|
||||
<Button key="close" type="primary" onClick={() => setShowDebugModal(false)}>
|
||||
Закрыть
|
||||
</Button>
|
||||
]}
|
||||
>
|
||||
<div style={{ textAlign: 'center', padding: '20px 0' }}>
|
||||
<p style={{ marginBottom: 16, color: '#666' }}>
|
||||
Это DEV режим. SMS не отправляется реально.
|
||||
</p>
|
||||
<div style={{
|
||||
fontSize: 32,
|
||||
fontWeight: 'bold',
|
||||
fontFamily: 'monospace',
|
||||
background: '#f5f5f5',
|
||||
padding: '16px 32px',
|
||||
borderRadius: 8,
|
||||
display: 'inline-block',
|
||||
letterSpacing: 8
|
||||
}}>
|
||||
{debugCode}
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user