Skip to main content

Overview

The Settings page allows you to customize your FinAI experience, including profile information, security settings, language preferences, and AI features.

Accessing Settings

Navigate to Settings from your dashboard menu. The system automatically creates default settings for new users:
# From app/routes/settings.py:14-18
if not current_user.settings:
    new_settings = UserSetting(user_id=current_user.id)
    db.session.add(new_settings)
    db.session.commit()

Profile Management

Update Your Name

1

Navigate to Profile Section

Open the Settings page and locate the Profile section.
2

Enter New Name

Update your full name in the text field.
3

Save Changes

Click Save to update your profile.
Your name cannot be empty. The system validates input before saving.
API Endpoint: POST /api/settings/profile
# From app/routes/settings.py:24-40
@settings_bp.route('/api/settings/profile', methods=['POST'])
@api_login_required
def update_profile():
    data = request.json
    new_name = data.get('fullName', '').strip()
    
    if not new_name:
        return jsonify({
            'status': 'error', 
            'message': 'Họ tên không được để trống'
        }), 400
        
    user = User.query.get(session['user_id'])
    user.name = new_name
    db.session.commit()
    return jsonify({
        'status': 'success', 
        'message': 'Cập nhật họ tên thành công!'
    })

Security Settings

Change Password

1

Enter Current Password

Provide your current password for verification.
2

Set New Password

Enter your new password and confirm it.
3

Submit

Click Update Password to save changes.
Ensure your new password is strong and unique. The system verifies your current password before allowing changes.
Password Validation:
# From app/routes/settings.py:43-70
@settings_bp.route('/api/settings/password', methods=['POST'])
@api_login_required
def update_password():
    data = request.json
    current_password = data.get('currentPassword')
    new_password = data.get('newPassword')
    confirm_password = data.get('confirmNewPassword')
    
    # Validation checks
    if new_password != confirm_password:
        return jsonify({
            'status': 'error', 
            'message': 'Mật khẩu mới không khớp nhau'
        }), 400
        
    user = User.query.get(session['user_id'])
    
    # Verify current password using hashed comparison
    if not user.check_password(current_password):
        return jsonify({
            'status': 'error', 
            'message': 'Mật khẩu hiện tại không đúng'
        }), 401
        
    # Update with hashed password
    user.set_password(new_password)
    db.session.commit()
Password hashing is handled by the User model:
# From app/models.py:28-32
def set_password(self, password):
    self.password_hash = generate_password_hash(password)

def check_password(self, password):
    return check_password_hash(self.password_hash, password)

Preferences

UserSetting Model

Your preferences are stored in the UserSetting model with the following fields:
# From app/models.py:37-45
class UserSetting(db.Model):
    __tablename__ = 'thietlapnguoidung'

    user_id = db.Column('MaNguoiDung', db.String(8), 
                        db.ForeignKey('nguoidung.MaNguoiDung', 
                        ondelete='CASCADE'), primary_key=True)
    currency = db.Column('DonViTienTe', db.String(10), default='VND')
    language = db.Column('NgonNgu', db.String(10), default='vi')
    notifications = db.Column('ThongBao', db.Integer, default=1)
    ai_suggestions = db.Column('AI_GoiY', db.Integer, default=1)
    theme = db.Column('GiaoDien', db.String(20), default='light')

Language and Currency

Customize your display language and currency format.Supported Options:
  • Currency: VND, USD, EUR, etc.
  • Language: Vietnamese (vi), English (en)
# From app/routes/settings.py:73-88
@settings_bp.route('/api/settings/preferences', methods=['POST'])
@api_login_required
def update_preferences():
    data = request.json
    currency = data.get('currency', 'VND')
    language = data.get('language', 'vi')
    
    user_setting = UserSetting.query.get(session['user_id'])
    user_setting.currency = currency
    user_setting.language = language
    db.session.commit()
    return jsonify({
        'status': 'success', 
        'message': 'Đã lưu tùy chỉnh!'
    })

AI Features

Control whether AI suggestions are enabled for your transactions. Toggle AI Suggestions:
# From app/routes/settings.py:91-108
@settings_bp.route('/api/settings/ai', methods=['POST'])
@api_login_required
def update_ai_settings():
    data = request.json
    ai_enabled = data.get('aiSuggestion')  # Boolean from UI
    
    user_setting = UserSetting.query.get(session['user_id'])
    # Store as Integer: 1 = Enabled, 0 = Disabled
    user_setting.ai_suggestions = 1 if ai_enabled else 0
    db.session.commit()
    
    status_msg = 'Đã BẬT AI' if ai_enabled else 'Đã TẮT AI'
    return jsonify({'status': 'success', 'message': status_msg})
AI suggestions help automatically categorize your transactions. When enabled, the system analyzes transaction descriptions and suggests appropriate categories.

Effect of Settings

How Settings Impact Your Experience

Currency Format

Your selected currency affects:
  • Transaction amount display
  • Budget limit formatting
  • Report summaries
  • Export file formatting

Language

Controls interface language for:
  • Dashboard labels
  • Report headings
  • Error messages
  • Date formats

AI Suggestions

When enabled:
  • Automatic category prediction for new transactions
  • Confidence scores displayed (stored in ai_confidence field)
  • Learning from your corrections to improve accuracy
Related model fields from Transaction:
# From app/models.py:96-97
ai_category_id = db.Column('MaDanhMuc_AI', db.String(8), 
                           db.ForeignKey('danhmuc.MaDanhMuc', 
                           ondelete='SET NULL'))
ai_confidence = db.Column('DoTinCay_AI', db.Float)

API Reference

EndpointMethodPurpose
/api/settings/profilePOSTUpdate user name
/api/settings/passwordPOSTChange password
/api/settings/preferencesPOSTUpdate currency/language
/api/settings/aiPOSTToggle AI suggestions
All settings endpoints require authentication via the @api_login_required decorator. Unauthenticated requests will be rejected.

Build docs developers (and LLMs) love