Verification Flow
Verification Route
The verification page is protected and requires an authenticated user:src/web/mod.rs
Users must be logged in via Discord OAuth before they can verify their email.
Email Validation
Only university email addresses are accepted:src/web/api/mod.rs
Valid Email Format
Emails must match the pattern:- Username: alphanumeric characters, dots, underscores, plus, or hyphen
- Domain:
@stud.hs-kempten.de
- ✅
john.doe@stud.hs-kempten.de - ✅
max_mueller@stud.hs-kempten.de - ❌
student@gmail.com - ❌
professor@hs-kempten.de
Duplicate Email Check
The system checks if an email is already registered:src/web/api/mod.rs
When a duplicate email is detected, users are prompted to switch accounts instead of creating a new verification.
Re-verification
Users can re-verify their email if needed:src/web/mod.rs
- Verification code expired
- Email changed
- Previous verification failed
Data Structures
Email Request
src/web/structs.rs
Code Verification Request
src/web/structs.rs
API Response
src/web/structs.rs
Error Handling
Error Codes
| Error Code | Status | Description |
|---|---|---|
ERR_USER_EXISTS | 400 | Email already registered |
FAILTHIS | 400 | Invalid email format or code |
SUCCESS | 200 | Operation successful |
Error Messages
All error messages are in German to match the university’s language:- Invalid email: “Ungültige E-Mail Adresse”
- Email exists: “E-Mail Adresse wird bereits verwendet, möchtest du stattdessen deinen Account wechseln?”
- Invalid code: “Ungültiger Code”
Frontend Integration
The verification page uses AJAX to communicate with the API:- User enters email
- JavaScript sends POST to
/api/verify/sendMail - Response shows success or error message
- User enters verification code
- JavaScript sends POST to
/api/verify/checkCode - On success, user gains verified status
Security Considerations
- Email validation prevents injection attacks
- Verification codes should expire after a set time
- Failed attempts should be logged
- HTTPS ensures email/code transmission is encrypted
Related Pages
Send Mail API
API endpoint for sending verification emails
Check Code API
API endpoint for verifying codes
User Management
Managing verified users
Switch Account
Switching between verified accounts