# AttributeError: 'NoneType' object has no attribute 'is_authenticated'

- **ID:** `python/flask-login-user-not-loaded`
- **Domain:** python
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Flask-Login 的 current_user 为 None。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   if current_user.is_authenticated:\n    # 处理逻辑\nelse:\n    return redirect(url_for('login'))
   ```
2. **** (90% success)
   ```
   from flask_login import login_required\n@app.route('/profile')\n@login_required\ndef profile():\n    return 'Profile'
   ```

## Dead Ends

- **** — 未登录时返回 None。 (90% fail)
- **** — 导致程序崩溃。 (80% fail)
