- Introduced profile update and password change functionalities in main.py. - Added new ProfileUpdate and PasswordChange schemas in user.py. - Updated base.html to include a profile link in the navigation and modified user chip for better accessibility. - Enhanced CSS for user chip links to improve UI interaction.
29 lines
658 B
Python
29 lines
658 B
Python
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
|
|
class UserCreate(BaseModel):
|
|
email: EmailStr
|
|
full_name: str = Field(min_length=2, max_length=255)
|
|
password: str = Field(min_length=10, max_length=255)
|
|
role: str = Field(default="reader", pattern="^(admin|editor|reader)$")
|
|
|
|
|
|
class ProfileUpdate(BaseModel):
|
|
email: EmailStr
|
|
full_name: str = Field(min_length=2, max_length=255)
|
|
|
|
|
|
class PasswordChange(BaseModel):
|
|
new_password: str = Field(min_length=10, max_length=255)
|
|
|
|
|
|
class UserOut(BaseModel):
|
|
id: int
|
|
email: EmailStr
|
|
full_name: str
|
|
role: str
|
|
is_active: bool
|
|
|
|
class Config:
|
|
from_attributes = True
|