Files
IOT_application/Machine-Backend/reset_password.py
2025-10-25 09:35:47 +05:30

19 lines
594 B
Python

from app import create_app, db
from app.models.models import User
from werkzeug.security import generate_password_hash
app = create_app()
with app.app_context():
email = "test@example.com"
new_password = "test123"
user = User.query.filter_by(email=email).first()
if not user:
print("User not found ❌")
else:
# Hash password in the way your model expects
user.password = generate_password_hash(new_password, method='pbkdf2:sha256')
db.session.commit()
print(f"Password reset successfully for {email}. Login with: {new_password}")