Skip to content

Commit c6a7925

Browse files
orabeCopilot
andcommitted
Add certificate verification link and update response schema
- Implement a public "Zertifikat prüfen" link in the navbar across all pages. - Update the certificate verification response to include a verification URL. Co-authored-by: Copilot <copilot@github.com>
1 parent fa738cf commit c6a7925

4 files changed

Lines changed: 30 additions & 2 deletions

File tree

assets/js/script.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@
33

44

55
// element toggle function
6+
7+
// Ensure a public "Zertifikat prüfen" link appears in the navbar on all pages
8+
;(function addVerifyNavItem(){
9+
const navLists = document.querySelectorAll('.navbar-list');
10+
if(!navLists) return;
11+
12+
navLists.forEach(list => {
13+
// Avoid adding duplicate links
14+
if (list.querySelector('a[href="verify/index.html"], a[href="/verify/index.html"]')) return;
15+
16+
const li = document.createElement('li');
17+
li.className = 'navbar-item';
18+
19+
const a = document.createElement('a');
20+
a.href = 'verify/index.html';
21+
22+
const btn = document.createElement('button');
23+
btn.className = 'navbar-link';
24+
btn.setAttribute('data-nav-link', '');
25+
btn.textContent = 'Zertifikat prüfen';
26+
27+
a.appendChild(btn);
28+
li.appendChild(a);
29+
list.appendChild(li);
30+
});
31+
})();
632
const elementToggleFunc = function (elem) { elem.classList.toggle("active"); }
733

834

backend/app/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def verify_certificate(certificate_id: str, db: Session = Depends(get_db)):
6060
"duration_hours": cert.duration_hours,
6161
"issuer": cert.issuer,
6262
"instructor": cert.instructor,
63-
"verified_at": datetime.utcnow().isoformat() + "Z"
63+
"verified_at": datetime.utcnow().isoformat() + "Z",
64+
"verification_url": f"https://mathcodelab.de/verify/?id={cert.certificate_id}"
6465
}
6566

6667
@app.post("/admin/certificates", response_model=schemas.CertificateOut)

backend/app/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Config:
2222
class CertificateVerificationResponse(BaseModel):
2323
status: str
2424
certificate_id: str
25+
verification_url: Optional[str] = None
2526
student_name: Optional[str] = None
2627
course_title: Optional[str] = None
2728
completion_date: Optional[str] = None

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ <h1 class="name" title="MathCodeLab">MathCodeLab</h1>
197197
</li>
198198
<li class="navbar-item">
199199
<a href="verify/index.html">
200-
<button class="navbar-link" data-nav-link>Verify Certificate</button>
200+
<button class="navbar-link" data-nav-link>Zertifikat prüfen</button>
201201
</a>
202202
</li>
203203
</ul>

0 commit comments

Comments
 (0)