mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: inline email retry on 550 rejection in tfe access request form
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -20,6 +20,7 @@
|
|||||||
## Bug fixes
|
## Bug fixes
|
||||||
- [x] **smtp-test.php** — wrap `SmtpRelay::send()` in `try/catch SmtpSendException` so SMTP delivery failures (e.g. 550 recipient rejected) surface as a proper flash error instead of an uncaught exception/silent crash
|
- [x] **smtp-test.php** — wrap `SmtpRelay::send()` in `try/catch SmtpSendException` so SMTP delivery failures (e.g. 550 recipient rejected) surface as a proper flash error instead of an uncaught exception/silent crash
|
||||||
- [x] **partage email retry** — on 550 recipient-rejected, redirect to `/partage/retry-email` instead of `recapitulatif`; student can correct address and resend or skip
|
- [x] **partage email retry** — on 550 recipient-rejected, redirect to `/partage/retry-email` instead of `recapitulatif`; student can correct address and resend or skip
|
||||||
|
- [x] **tfe access form email retry** — on `recipient_rejected` JSON response, highlight email field in red, show corrected error message, let user fix and resubmit inline
|
||||||
- [x] **ThesisCreateController** — `confirmation_email` is now optional (empty = skip send)
|
- [x] **ThesisCreateController** — `confirmation_email` is now optional (empty = skip send)
|
||||||
- [x] **admin/add.php template** — email confirmation field marked optional, label and hint updated
|
- [x] **admin/add.php template** — email confirmation field marked optional, label and hint updated
|
||||||
|
|
||||||
|
|||||||
@@ -324,6 +324,11 @@ aside figcaption {
|
|||||||
color: #742a2a;
|
color: #742a2a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tfe-access-request-form input.input-error {
|
||||||
|
border-color: #fc8181;
|
||||||
|
outline-color: #fc8181;
|
||||||
|
}
|
||||||
|
|
||||||
/* Responsive */
|
/* Responsive */
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.tfe-layout {
|
.tfe-layout {
|
||||||
|
|||||||
@@ -7,3 +7,4 @@
|
|||||||
{"source":"partage","action":"submit","status":"success","thesis_id":21,"identifier":"2025-018","author":"Théo Marchand","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:41:38+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
{"source":"partage","action":"submit","status":"success","thesis_id":21,"identifier":"2025-018","author":"Théo Marchand","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:41:38+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
||||||
{"source":"partage","action":"submit","status":"success","thesis_id":22,"identifier":"2025-019","author":"Lila Dubois, Karim Nassar","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:45:36+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
{"source":"partage","action":"submit","status":"success","thesis_id":22,"identifier":"2025-019","author":"Lila Dubois, Karim Nassar","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:45:36+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
||||||
{"source":"partage","action":"submit","status":"success","thesis_id":23,"identifier":"2025-020","author":"Zoé Lambert","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:46:49+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
{"source":"partage","action":"submit","status":"success","thesis_id":23,"identifier":"2025-020","author":"Zoé Lambert","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:46:49+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
||||||
|
{"source":"partage","action":"submit","status":"success","thesis_id":24,"identifier":"2025-021","author":"Emma Renard","share_slug":"20260429-DZESJT6X","timestamp":"2026-04-30T11:49:49+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"}
|
||||||
|
|||||||
@@ -327,6 +327,25 @@
|
|||||||
justificationInput.required = !isErg;
|
justificationInput.required = !isErg;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showRetryPrompt(rejectedEmail, serverMessage) {
|
||||||
|
messageDiv.style.display = 'block';
|
||||||
|
messageDiv.className = 'tfe-access-message tfe-access-error';
|
||||||
|
messageDiv.innerHTML =
|
||||||
|
'<strong>Adresse e-mail introuvable sur le serveur de l\'ERG.</strong><br>' +
|
||||||
|
'<small>' + serverMessage.replace(/</g, '<') + '</small><br><br>' +
|
||||||
|
'Corrigez votre adresse e-mail et réessayez.';
|
||||||
|
// Highlight the email field and let the user fix it
|
||||||
|
emailInput.value = rejectedEmail;
|
||||||
|
emailInput.classList.add('input-error');
|
||||||
|
emailInput.focus();
|
||||||
|
emailInput.select();
|
||||||
|
// Remove error highlight once they start typing
|
||||||
|
emailInput.addEventListener('input', function clearError() {
|
||||||
|
emailInput.classList.remove('input-error');
|
||||||
|
emailInput.removeEventListener('input', clearError);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Form submission
|
// Form submission
|
||||||
form.addEventListener('submit', function(e) {
|
form.addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -336,6 +355,7 @@
|
|||||||
submitBtn.textContent = 'Envoi en cours...';
|
submitBtn.textContent = 'Envoi en cours...';
|
||||||
messageDiv.style.display = 'none';
|
messageDiv.style.display = 'none';
|
||||||
|
|
||||||
|
const submittedEmail = emailInput.value.trim();
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
formData.append('thesis_id', '<?= $thesisId ?>');
|
formData.append('thesis_id', '<?= $thesisId ?>');
|
||||||
|
|
||||||
@@ -348,6 +368,11 @@
|
|||||||
submitBtn.disabled = false;
|
submitBtn.disabled = false;
|
||||||
submitBtn.textContent = 'Demander l\'accès';
|
submitBtn.textContent = 'Demander l\'accès';
|
||||||
|
|
||||||
|
if (data.status === 'recipient_rejected') {
|
||||||
|
showRetryPrompt(submittedEmail, data.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
messageDiv.style.display = 'block';
|
messageDiv.style.display = 'block';
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
messageDiv.className = 'tfe-access-message tfe-access-success';
|
messageDiv.className = 'tfe-access-message tfe-access-success';
|
||||||
|
|||||||
Reference in New Issue
Block a user