chore: Änderungen commited

This commit is contained in:
2025-05-02 19:23:38 +02:00
parent 7003c89447
commit 84f8a6bf31
6 changed files with 128 additions and 39 deletions

Binary file not shown.

104
app.py
View File

@@ -487,32 +487,94 @@ def settings():
if request.method == 'POST':
action = request.form.get('action')
# Bestimme, ob es eine AJAX-Anfrage ist
is_ajax = request.headers.get('X-Requested-With') == 'XMLHttpRequest' or request.content_type and 'multipart/form-data' in request.content_type
if action == 'update_profile':
current_user.bio = request.form.get('bio')
# Update avatar if provided
avatar_url = request.form.get('avatar_url')
if avatar_url:
current_user.avatar = avatar_url
try:
current_user.bio = request.form.get('bio', '')
current_user.location = request.form.get('location', '')
current_user.website = request.form.get('website', '')
db.session.commit()
flash('Profil erfolgreich aktualisiert!', 'success')
# Update avatar if provided
avatar_url = request.form.get('avatar_url')
if avatar_url:
current_user.avatar = avatar_url
db.session.commit()
if is_ajax:
return jsonify({
'success': True,
'message': 'Profil erfolgreich aktualisiert!'
})
else:
flash('Profil erfolgreich aktualisiert!', 'success')
except Exception as e:
db.session.rollback()
app.logger.error(f"Fehler beim Aktualisieren des Profils: {str(e)}")
if is_ajax:
return jsonify({
'success': False,
'message': 'Fehler beim Aktualisieren des Profils'
}), 500
else:
flash('Fehler beim Aktualisieren des Profils', 'error')
elif action == 'update_password':
current_password = request.form.get('current_password')
new_password = request.form.get('new_password')
confirm_password = request.form.get('confirm_password')
if not current_user.check_password(current_password):
flash('Aktuelles Passwort ist nicht korrekt', 'error')
elif new_password != confirm_password:
flash('Neue Passwörter stimmen nicht überein', 'error')
else:
current_user.set_password(new_password)
db.session.commit()
flash('Passwort erfolgreich aktualisiert!', 'success')
try:
current_password = request.form.get('current_password')
new_password = request.form.get('new_password')
confirm_password = request.form.get('confirm_password')
if not current_user.check_password(current_password):
if is_ajax:
return jsonify({
'success': False,
'message': 'Aktuelles Passwort ist nicht korrekt'
}), 400
else:
flash('Aktuelles Passwort ist nicht korrekt', 'error')
elif new_password != confirm_password:
if is_ajax:
return jsonify({
'success': False,
'message': 'Neue Passwörter stimmen nicht überein'
}), 400
else:
flash('Neue Passwörter stimmen nicht überein', 'error')
else:
current_user.set_password(new_password)
db.session.commit()
if is_ajax:
return jsonify({
'success': True,
'message': 'Passwort erfolgreich aktualisiert!'
})
else:
flash('Passwort erfolgreich aktualisiert!', 'success')
except Exception as e:
db.session.rollback()
app.logger.error(f"Fehler beim Aktualisieren des Passworts: {str(e)}")
if is_ajax:
return jsonify({
'success': False,
'message': 'Fehler beim Aktualisieren des Passworts'
}), 500
else:
flash('Fehler beim Aktualisieren des Passworts', 'error')
return redirect(url_for('settings'))
if not is_ajax:
return redirect(url_for('settings'))
else:
# Standardantwort für AJAX, falls keine spezifische Antwort zurückgegeben wurde
return jsonify({
'success': True,
'message': 'Einstellungen aktualisiert'
})
return render_template('settings.html')

View File

@@ -12,7 +12,7 @@ from datetime import datetime
# Erstelle eine temporäre Flask-App, um die Datenbank zu initialisieren
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///systades.db'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database/systades.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)

Binary file not shown.

View File

@@ -2,6 +2,8 @@
#chatgpt-assistant {
font-family: 'Inter', sans-serif;
bottom: 5.5rem;
z-index: 100;
max-height: 85vh;
}
#assistant-chat {
@@ -11,7 +13,15 @@
border-radius: 0.75rem;
overflow: hidden;
max-width: calc(100vw - 2rem);
max-height: 75vh !important;
max-height: 80vh !important;
}
#assistant-history {
max-height: calc(80vh - 150px);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
padding-bottom: 2rem; /* Zusätzlicher Abstand unten */
}
#assistant-toggle {
@@ -24,11 +34,6 @@
transform: scale(1.1) rotate(10deg);
}
#assistant-history {
scrollbar-width: thin;
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}
#assistant-history::-webkit-scrollbar {
width: 6px;
}

View File

@@ -474,18 +474,19 @@ body:not(.dark) a:hover {
}
/* Light Mode Buttons */
body:not(.dark) button:not(.toggle):not(.plain-btn) {
color: white !important;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
body:not(.dark) .btn,
body:not(.dark) button:not(.toggle) {
background: linear-gradient(135deg, #6d28d9, #5b21b6);
color: white;
border: none;
box-shadow: 0 2px 4px rgba(91, 33, 182, 0.25);
border-radius: 8px;
padding: 0.625rem 1.25rem;
transition: all 0.2s ease;
font-weight: 600;
letter-spacing: 0.02em;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
body:not(.dark) .btn-primary,
body:not(.dark) .btn-secondary,
body:not(.dark) .btn-success,
body:not(.dark) .btn-danger,
body:not(.dark) .btn-warning,
body:not(.dark) .btn-info {
color: white !important;
}
body:not(.dark) .btn:hover,
@@ -1043,4 +1044,25 @@ body:not(.dark) .chat-message-user {
.chat-assistant .chat-messages {
max-height: calc(85vh - 180px); /* Angepasst für größeres Fenster */
overflow-y: auto;
padding-bottom: 2rem; /* Zusätzlicher Abstand um Abschneiden zu vermeiden */
}
/* Verbesserungen für das Mobilmenü */
@media (max-width: 768px) {
.mobile-menu-container {
max-height: 85vh;
overflow-y: auto;
}
#chatgpt-assistant {
bottom: 4.5rem !important;
}
.chat-assistant {
max-height: 70vh !important;
}
.chat-assistant .chat-messages {
max-height: calc(70vh - 160px) !important;
}
}