(session: SessionDep, current_user: CurrentUser, trans: Trans, editor: PwdEditor)
| 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")) |
| 297 | async 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") |
nothing calls this directly
no test coverage detected