MCPcopy Index your code
hub / github.com/dataease/SQLBot / pwdReset

Function pwdReset

backend/apps/system/api/user.py:287–292  ·  view source on GitHub ↗
(session: SessionDep, current_user: CurrentUser, trans: Trans, id: int = Path(description=f"{PLACEHOLDER_PREFIX}uid"))

Source from the content-addressed store, hash-verified

285@clear_cache(namespace=CacheNamespace.AUTH_INFO, cacheName=CacheName.USER_INFO, keyExpression="id")
286@system_log(LogConfig(operation_type=OperationType.RESET_PWD,module=OperationModules.USER,resource_id_expr="id"))
287async def pwdReset(session: SessionDep, current_user: CurrentUser, trans: Trans, id: int = Path(description=f"{PLACEHOLDER_PREFIX}uid")):
288 if not current_user.isAdmin:
289 raise Exception(trans('i18n_permission.no_permission', url = " patch[/user/pwd/id],", msg = trans('i18n_permission.only_admin')))
290 db_user: UserModel = get_db_user(session=session, user_id=id)
291 db_user.password = default_md5_pwd()
292 session.add(db_user)
293
294@router.put("/pwd", summary=f"{PLACEHOLDER_PREFIX}update_pwd", description=f"{PLACEHOLDER_PREFIX}update_pwd")
295@clear_cache(namespace=CacheNamespace.AUTH_INFO, cacheName=CacheName.USER_INFO, keyExpression="current_user.id")

Callers

nothing calls this directly

Calls 3

get_db_userFunction · 0.90
default_md5_pwdFunction · 0.90
addMethod · 0.65

Tested by

no test coverage detected