mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-06 18:49:47 +08:00
20 lines
638 B
Python
20 lines
638 B
Python
from fastapi import Depends, Form
|
|
from starlette.requests import Request
|
|
|
|
from fastapi_admin.depends import get_current_admin, get_resources
|
|
from fastapi_admin.models import AbstractAdmin
|
|
from fastapi_admin.providers.login import UsernamePasswordProvider
|
|
|
|
|
|
class LoginProvider(UsernamePasswordProvider):
|
|
async def password(
|
|
self,
|
|
request: Request,
|
|
old_password: str = Form(...),
|
|
new_password: str = Form(...),
|
|
re_new_password: str = Form(...),
|
|
admin: AbstractAdmin = Depends(get_current_admin),
|
|
resources=Depends(get_resources),
|
|
):
|
|
return await self.logout(request)
|