ishingiro / tests /debug_forgot_password.html
IZERE HIRWA Roger
add lg files
eeacc46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debug Forgot Password</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
.debug-info { background: #f0f0f0; padding: 10px; margin: 10px 0; border-radius: 5px; }
.error { color: red; }
.success { color: green; }
</style>
</head>
<body>
<h1>Debug Forgot Password</h1>
<div class="debug-info">
<h3>Testing Forgot Password API</h3>
<button onclick="testForgotPassword()">Test Forgot Password</button>
<div id="result"></div>
</div>
<script>
const API_ROOT = 'https://prodevroger-ishingiro.hf.space';
async function api(path, opts) {
const url = API_ROOT + path;
const res = await fetch(url, opts);
if (!res.ok) {
const txt = await res.text();
throw new Error(txt || res.statusText);
}
return res.json();
}
async function testForgotPassword() {
const resultDiv = document.getElementById('result');
resultDiv.innerHTML = '<p>Testing...</p>';
try {
console.log('Testing forgot password for: it.elias38@gmail.com');
const res = await api('/forgot_password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: 'it.elias38@gmail.com' })
});
console.log('API response:', res);
resultDiv.innerHTML = `
<div class="success">
<h4>✅ Success!</h4>
<pre>${JSON.stringify(res, null, 2)}</pre>
</div>
`;
} catch (err) {
console.error('Error:', err);
resultDiv.innerHTML = `
<div class="error">
<h4>❌ Error:</h4>
<p>${err.message}</p>
</div>
`;
}
}
</script>
</body>
</html>