Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Develop #24

wants to merge 3 commits into from

Conversation

TsvetanKichuk
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the user account management endpoints! 🎉 Your code is well-structured and meets the task requirements. While there are a few areas for improvement, such as handling password hashing, token validation, and using the Config class for Pydantic models, these are minor and don't impact the core functionality. Keep up the good work and consider these suggestions for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

)

try:
user.password = data.password

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the password is hashed before being stored. If UserModel does not handle hashing internally, consider using a hashing function here.

token_record = db.query(PasswordResetTokenModel).filter_by(user_id=user.id).first()

expires_at = cast(datetime, token_record.expires_at).replace(tzinfo=timezone.utc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if token_record is not None before accessing token_record.expires_at to avoid AttributeError.

"""
try:
decoded_token = jwt_manager.decode_refresh_token(token_data.refresh_token)
user_id = decoded_token.get("user_id")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that user_id is not None after decoding the token. Handle the case where decoded_token might not contain user_id.

@field_validator("password")
@classmethod
def validate_password(cls, value):
return accounts_validators.validate_password_strength(value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that accounts_validators.validate_password_strength is correctly implemented and imported. This function should enforce the desired password strength requirements.

Comment on lines +10 to +12
model_config = {
"from_attributes": True
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model_config attribute is not a standard Pydantic feature. Consider using a Config class for model configuration, e.g., class Config: from_attributes = True.

Comment on lines +51 to +53
model_config = {
"from_attributes": True
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous comment, consider using a Config class for model configuration instead of model_config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants