Skip to content

Conversation

@df530
Copy link
Owner

@df530 df530 commented Sep 19, 2021

No description provided.



class User(BaseModel):
mail: str = Field(..., regex=r".+@.+\..+")

Choose a reason for hiding this comment

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

У pydantic есть отдельный тип EmailStr для валидации полей, хранящих почту.

Comment on lines +27 to +28
password1: str
password2: str

Choose a reason for hiding this comment

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

Аналогично у pydantic есть поля и для паролей.

Совет с точки зрения проектирования: данные пользователя (имя, возраст, почта и все, что может быть нужно для какой-то аналитики и таргетирования) лучше хранить отдельно от данных для авторизации (логин/пароль/соли и т.д.).

Так можно ненароком забыть и спалить где-нибудь пользовательский пароль, и они очень сильно расстроятся, что хуже возможно засудят 😁

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.

3 participants