feat(teamsbot): add email+password fields to auth test UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fa6277773d
commit
39ffce5a7d
2 changed files with 37 additions and 3 deletions
|
|
@ -324,8 +324,11 @@ export async function fetchVoices(languageCode: string): Promise<VoiceOption[]>
|
|||
* receive the /v2/ (authenticated) vs light-meetings (anonymous) page.
|
||||
* Does NOT join the meeting.
|
||||
*/
|
||||
export async function testAuth(instanceId: string, meetingUrl: string): Promise<AuthTestResults> {
|
||||
const response = await api.post(`/api/teamsbot/${instanceId}/test-auth`, { meetingUrl }, {
|
||||
export async function testAuth(instanceId: string, meetingUrl: string, botEmail?: string, botPassword?: string): Promise<AuthTestResults> {
|
||||
const payload: Record<string, string> = { meetingUrl };
|
||||
if (botEmail) payload.botEmail = botEmail;
|
||||
if (botPassword) payload.botPassword = botPassword;
|
||||
const response = await api.post(`/api/teamsbot/${instanceId}/test-auth`, payload, {
|
||||
timeout: 300000, // 5 minutes — tests run sequentially
|
||||
});
|
||||
return response.data;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ export const TeamsbotSettingsView: React.FC = () => {
|
|||
|
||||
// Auth detection test state
|
||||
const [testMeetingUrl, setTestMeetingUrl] = useState('');
|
||||
const [testBotEmail, setTestBotEmail] = useState('');
|
||||
const [testBotPassword, setTestBotPassword] = useState('');
|
||||
const [testRunning, setTestRunning] = useState(false);
|
||||
const [testResults, setTestResults] = useState<AuthTestResults | null>(null);
|
||||
const [testError, setTestError] = useState<string | null>(null);
|
||||
|
|
@ -157,7 +159,12 @@ export const TeamsbotSettingsView: React.FC = () => {
|
|||
setTestError(null);
|
||||
|
||||
try {
|
||||
const results = await teamsbotApi.testAuth(instanceId, testMeetingUrl.trim());
|
||||
const results = await teamsbotApi.testAuth(
|
||||
instanceId,
|
||||
testMeetingUrl.trim(),
|
||||
testBotEmail.trim() || undefined,
|
||||
testBotPassword || undefined,
|
||||
);
|
||||
setTestResults(results);
|
||||
} catch (err: any) {
|
||||
setTestError(err.message || 'Auth-Test fehlgeschlagen');
|
||||
|
|
@ -253,6 +260,30 @@ export const TeamsbotSettingsView: React.FC = () => {
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<div className={styles.testInputRow} style={{ marginTop: '0.5rem', gap: '0.5rem' }}>
|
||||
<input
|
||||
type="email"
|
||||
className={styles.input}
|
||||
value={testBotEmail}
|
||||
onChange={(e) => setTestBotEmail(e.target.value)}
|
||||
placeholder="Bot-Email (z.B. nyla.larsson@poweron.swiss)"
|
||||
disabled={testRunning}
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
className={styles.input}
|
||||
value={testBotPassword}
|
||||
onChange={(e) => setTestBotPassword(e.target.value)}
|
||||
placeholder="Bot-Passwort"
|
||||
disabled={testRunning}
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
</div>
|
||||
<span className={styles.hint}>
|
||||
Optional: Bot-Credentials fuer Auth-Test. Werden beim ersten Test automatisch in der DB gespeichert.
|
||||
</span>
|
||||
|
||||
{testRunning && (
|
||||
<div className={styles.testProgress}>
|
||||
<FaSpinner className={styles.spinner} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue