Skip to content

Commit 1af98b3

Browse files
committed
Feat: admin endpoint to invalidate one user's passwd
1 parent 56f6eca commit 1af98b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/core/users/endpoints_users.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,21 @@ async def change_password(
743743
return standard_responses.Result()
744744

745745

746+
@router.post("/users/invalidate-password/{user_id}", status_code=201)
747+
async def invalidate_password(
748+
user_id: str,
749+
user: models_users.CoreUser = Depends(is_user_in(GroupType.admin)),
750+
db: AsyncSession = Depends(get_db),
751+
):
752+
"""
753+
Invalidate one user's password.
754+
The concerned user should change their password with a different one to use our services again.
755+
756+
**This endpoint is only usable by administrators**
757+
"""
758+
await cruds_users.update_should_user_change_password_by_id(db=db, user_id=user_id)
759+
760+
746761
@router.post(
747762
"/users/migrate-mail",
748763
status_code=204,

0 commit comments

Comments
 (0)