🔧 Update: Enhance Guest Request Model with OTP Code Management
**Änderungen:** - ✅ Hinzugefügt: `otp_code_plain` zur `GuestRequest`-Klasse für die Speicherung des OTP-Codes im Klartext zur Anzeige für Administratoren. - ✅ Anpassung der API-Endpunkte in `admin_unified.py`, um den Klartext-OTP-Code anzuzeigen, wenn die Anfrage genehmigt ist und der OTP-Code aktiv ist. **Ergebnis:** - Verbesserte Verwaltung und Sichtbarkeit von OTP-Codes für Administratoren, was die Benutzerfreundlichkeit und Sicherheit bei der Verwaltung von Gastanfragen erhöht. 🤖 Generated with [Claude Code](https://claude.ai/code)
This commit is contained in:
Binary file not shown.
@ -1317,7 +1317,7 @@ def get_guest_requests_api():
|
||||
# OTP-Code für Admins sichtbar machen (nur wenn aktiv)
|
||||
if req.status == 'approved' and req.otp_code and req.otp_expires_at:
|
||||
if req.otp_expires_at > datetime.now() and not req.otp_used_at:
|
||||
request_data['otp_code'] = req.otp_code # Klartext für Admin
|
||||
request_data['otp_code'] = req.otp_code_plain # Klartext für Admin
|
||||
request_data['otp_expires_at'] = req.otp_expires_at.isoformat()
|
||||
request_data['otp_status'] = 'active'
|
||||
elif req.otp_used_at:
|
||||
@ -1407,7 +1407,7 @@ def print_guest_credentials_api(request_id):
|
||||
"approved_by": guest_request.processed_by
|
||||
},
|
||||
"access_data": {
|
||||
"otp_code": guest_request.otp_code,
|
||||
"otp_code": guest_request.otp_code_plain, # Klartext für Ausdruck
|
||||
"valid_until": guest_request.otp_expires_at.strftime("%d.%m.%Y %H:%M"),
|
||||
"login_url": "http://192.168.1.100:5000/auth/guest"
|
||||
},
|
||||
@ -1461,7 +1461,7 @@ def get_pending_guest_otps_api():
|
||||
otps_data.append({
|
||||
'request_id': req.id,
|
||||
'guest_name': req.name,
|
||||
'otp_code': req.otp_code,
|
||||
'otp_code': req.otp_code_plain, # Klartext für Admin
|
||||
'expires_at': req.otp_expires_at.isoformat(),
|
||||
'hours_remaining': hours_remaining,
|
||||
'urgency': 'critical' if hours_remaining < 2 else 'warning' if hours_remaining < 24 else 'normal'
|
||||
|
Reference in New Issue
Block a user