rideaware-api/server.py
Blake Ridgway 4a4d693d72 fix: resolve AttributeError in User model and ensure consistent password handling
- Fixed the `AttributeError: 'User' object has no attribute '_password'` by properly mapping the `_password` attribute to the `password` column in the database.
- Updated the `User` model to ensure passwords are only hashed once during creation and not re-hashed when retrieved or updated.
- Improved the `check_password` method to correctly compare hashed passwords.
- Verified the signup and login flow to ensure consistent behavior
2025-02-15 22:42:50 -06:00

25 lines
516 B
Python

import os
from flask import Flask
from models import db, init_db
from routes.user_auth.auth import auth_bp
from dotenv import load_dotenv
from flask_cors import CORS
load_dotenv()
app = Flask(__name__)
CORS(app)
app.secret_key = os.getenv('SECRET_KEY')
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
init_db(app)
app.register_blueprint(auth_bp)
with app.app_context():
db.create_all()
if __name__ == '__main__':
app.run(debug=True)