File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,10 @@ def test_job_create(self):
193
193
194
194
}
195
195
196
+ # Check that anonymous posting is not allowed. See #852.
197
+ response = self .client .post (url , post_data )
198
+ self .assertEqual (response .status_code , 404 )
199
+
196
200
if 0 :
197
201
# Disabled for now, until we have found a better solution
198
202
# to fight spammers. See #852.
Original file line number Diff line number Diff line change @@ -278,14 +278,14 @@ def get_form_kwargs(self):
278
278
279
279
def form_valid (self , form ):
280
280
""" set the creator to the current user """
281
- # Associate Job to user if they are logged in
282
- if self . request . user . is_authenticated ():
283
- form . instance . creator = self .request .user
284
- else :
285
- # Temporary measure against spammers. See #852.
286
- return super (). form_invalid ( form )
287
- return super (). form_valid ( form )
288
-
281
+
282
+ # Don't allow anonymous postings; see #852.
283
+ if not self .request .user . is_authenticated ():
284
+ raise Http404
285
+
286
+ # Associate Job to user
287
+ form . instance . creator = self . request . user
288
+ return super (). form_valid ( form )
289
289
290
290
291
291
class JobEdit (JobMixin , UpdateView ):
You can’t perform that action at this time.
0 commit comments