mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2026-03-13 10:32:25 +08:00
override example password
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
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 update_password(self, admin: AbstractAdmin, password: str):
|
||||
pass
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user