def _check_post_settings(board: BoardModel, post_details):
site_config = site_service.get_site_config()
if not site_config.posting_enabled:
raise BadRequestError(MESSAGE_POSTING_DISABLED)
if post_details.has_file and not site_config.file_posting:
raise BadRequestError(MESSAGE_FILE_POSTING_DISABLED)
if board.config.posting_verification_required and not verification_service.is_verified(request):
method = verification_service.get_method()
if method.verification_in_request(request):
try:
method.verify_request(request)
verification_service.set_verified(request)
except ArgumentError as e:
raise BadRequestError(e)
else:
message = 'Please verify here first before posting.'
if request.is_xhr:
xhr_response = {
'error': True,
'message': page_formatting('[{}](_/verify/)'.format(message))
}
return jsonify(xhr_response), 400
else:
with_refresh = '[{}](_/verify/)\n\n**Refresh this page after verifying.**'.format(message)
return render_template('error.html', message=with_refresh, with_retry=True), 400
评论列表
文章目录