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

Function pwdUpdate

backend/apps/system/api/user.py:297–306  ·  view source on GitHub ↗
(session: SessionDep, current_user: CurrentUser, trans: Trans, editor: PwdEditor)

Source from the content-addressed store, hash-verified

295@clear_cache(namespace=CacheNamespace.AUTH_INFO, cacheName=CacheName.USER_INFO, keyExpression="current_user.id")
296@system_log(LogConfig(operation_type=OperationType.UPDATE_PWD,module=OperationModules.USER,result_id_expr="id"))
297async def pwdUpdate(session: SessionDep, current_user: CurrentUser, trans: Trans, editor: PwdEditor):
298 new_pwd = editor.new_pwd
299 if not check_pwd_format(new_pwd):
300 raise Exception(trans('i18n_format_invalid', key = trans('i18n_user.password')))
301 db_user: UserModel = get_db_user(session=session, user_id=current_user.id)
302 if not verify_md5pwd(editor.pwd, db_user.password):
303 raise Exception(trans('i18n_error', key = trans('i18n_user.password')))
304 db_user.password = md5pwd(new_pwd)
305 session.add(db_user)
306 return db_user
307
308
309@router.patch("/status", summary=f"{PLACEHOLDER_PREFIX}update_status", description=f"{PLACEHOLDER_PREFIX}update_status")

Callers

nothing calls this directly

Calls 5

check_pwd_formatFunction · 0.90
get_db_userFunction · 0.90
verify_md5pwdFunction · 0.90
md5pwdFunction · 0.90
addMethod · 0.65

Tested by

no test coverage detected