-
如果您的其中一个视图接收到
容易包含敏感信息的POST parameters对象,您可以使用HttpRequestsensitive_post_parameters装饰器阻止这些参数的值包含在错误报告中:from django.views.decorators.debug import sensitive_post_parameters @sensitive_post_parameters('pass_word', 'credit_card_number') def record_user_profile(request): UserProfile.create( user=request.user, password=request.POST['pass_word'], credit_card=request.POST['credit_card_number'], name=request.POST['name'], ) ...在上面的示例中,
pass_word和credit_card_numberPOST 参数的值将被隐藏并替换为错误报告中请求表示中的星号 (**********),而name参数的值将是披露。要在错误报告中系统地隐藏请求的所有 POST 参数,请不要向
sensitive_post_parameters装饰器提供任何参数:@sensitive_post_parameters() def my_view(request): ...对于某些
视图(django.contrib.auth.viewslogin、password_reset_confirm、password_change和authadmin 中的add_view和user_change_password),所有 POST 参数都系统地从错误报告中过滤出来,以防止敏感信息泄漏用户密码等信息。
本文介绍django.views.decorators.debug.sensitive_post_parameters的用法。
声明
sensitive_post_parameters(*parameters)
相关用法
- Python Django sensitive_variables用法及代码示例
- Python dict setdefault()用法及代码示例
- Python seaborn.swarmplot()用法及代码示例
- Python seaborn.residplot()用法及代码示例
- Python calendar setfirstweekday()用法及代码示例
- Python Django serve用法及代码示例
- Python seaborn.regplot()用法及代码示例
- Python seaborn.PairGrid()用法及代码示例
- Python set clear()用法及代码示例
- Python Tableau server_info.get用法及代码示例
- Python Pandas series.cummax()用法及代码示例
- Python seaborn.boxenplot()用法及代码示例
- Python Pandas series.cumprod()用法及代码示例
- Python Django set用法及代码示例
- Python seaborn.pairplot()用法及代码示例
- Python OpenCV setWindowTitle()用法及代码示例
- Python seaborn.factorplot()用法及代码示例
- Python seaborn.FacetGrid()用法及代码示例
- Python seaborn.lineplot()用法及代码示例
- Python seaborn.lmplot()用法及代码示例
- Python set()用法及代码示例
- Python setattr()用法及代码示例
- Python set copy()用法及代码示例
- Python seaborn.pointplot()用法及代码示例
- Python set add()用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.views.decorators.debug.sensitive_post_parameters。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
