chore: Änderungen commited
This commit is contained in:
Binary file not shown.
100
app.py
100
app.py
@@ -487,32 +487,94 @@ def settings():
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
action = request.form.get('action')
|
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':
|
if action == 'update_profile':
|
||||||
current_user.bio = request.form.get('bio')
|
try:
|
||||||
|
current_user.bio = request.form.get('bio', '')
|
||||||
|
current_user.location = request.form.get('location', '')
|
||||||
|
current_user.website = request.form.get('website', '')
|
||||||
|
|
||||||
# Update avatar if provided
|
# Update avatar if provided
|
||||||
avatar_url = request.form.get('avatar_url')
|
avatar_url = request.form.get('avatar_url')
|
||||||
if avatar_url:
|
if avatar_url:
|
||||||
current_user.avatar = avatar_url
|
current_user.avatar = avatar_url
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash('Profil erfolgreich aktualisiert!', 'success')
|
|
||||||
|
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':
|
elif action == 'update_password':
|
||||||
current_password = request.form.get('current_password')
|
try:
|
||||||
new_password = request.form.get('new_password')
|
current_password = request.form.get('current_password')
|
||||||
confirm_password = request.form.get('confirm_password')
|
new_password = request.form.get('new_password')
|
||||||
|
confirm_password = request.form.get('confirm_password')
|
||||||
|
|
||||||
if not current_user.check_password(current_password):
|
if not current_user.check_password(current_password):
|
||||||
flash('Aktuelles Passwort ist nicht korrekt', 'error')
|
if is_ajax:
|
||||||
elif new_password != confirm_password:
|
return jsonify({
|
||||||
flash('Neue Passwörter stimmen nicht überein', 'error')
|
'success': False,
|
||||||
else:
|
'message': 'Aktuelles Passwort ist nicht korrekt'
|
||||||
current_user.set_password(new_password)
|
}), 400
|
||||||
db.session.commit()
|
else:
|
||||||
flash('Passwort erfolgreich aktualisiert!', 'success')
|
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()
|
||||||
|
|
||||||
return redirect(url_for('settings'))
|
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')
|
||||||
|
|
||||||
|
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')
|
return render_template('settings.html')
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
# Erstelle eine temporäre Flask-App, um die Datenbank zu initialisieren
|
# Erstelle eine temporäre Flask-App, um die Datenbank zu initialisieren
|
||||||
app = Flask(__name__)
|
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
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -2,6 +2,8 @@
|
|||||||
#chatgpt-assistant {
|
#chatgpt-assistant {
|
||||||
font-family: 'Inter', sans-serif;
|
font-family: 'Inter', sans-serif;
|
||||||
bottom: 5.5rem;
|
bottom: 5.5rem;
|
||||||
|
z-index: 100;
|
||||||
|
max-height: 85vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
#assistant-chat {
|
#assistant-chat {
|
||||||
@@ -11,7 +13,15 @@
|
|||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-width: calc(100vw - 2rem);
|
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 {
|
#assistant-toggle {
|
||||||
@@ -24,11 +34,6 @@
|
|||||||
transform: scale(1.1) rotate(10deg);
|
transform: scale(1.1) rotate(10deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#assistant-history {
|
|
||||||
scrollbar-width: thin;
|
|
||||||
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#assistant-history::-webkit-scrollbar {
|
#assistant-history::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,18 +474,19 @@ body:not(.dark) a:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Light Mode Buttons */
|
/* 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) .btn,
|
||||||
body:not(.dark) button:not(.toggle) {
|
body:not(.dark) .btn-primary,
|
||||||
background: linear-gradient(135deg, #6d28d9, #5b21b6);
|
body:not(.dark) .btn-secondary,
|
||||||
color: white;
|
body:not(.dark) .btn-success,
|
||||||
border: none;
|
body:not(.dark) .btn-danger,
|
||||||
box-shadow: 0 2px 4px rgba(91, 33, 182, 0.25);
|
body:not(.dark) .btn-warning,
|
||||||
border-radius: 8px;
|
body:not(.dark) .btn-info {
|
||||||
padding: 0.625rem 1.25rem;
|
color: white !important;
|
||||||
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:hover,
|
body:not(.dark) .btn:hover,
|
||||||
@@ -1043,4 +1044,25 @@ body:not(.dark) .chat-message-user {
|
|||||||
.chat-assistant .chat-messages {
|
.chat-assistant .chat-messages {
|
||||||
max-height: calc(85vh - 180px); /* Angepasst für größeres Fenster */
|
max-height: calc(85vh - 180px); /* Angepasst für größeres Fenster */
|
||||||
overflow-y: auto;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user