Commit 12317d90 authored by Daniel W Bond's avatar Daniel W Bond

Merge branch 'issue32' into 'master'

Ratethrottled appropriate classes with standard values. Closes #32

See merge request !12
parents 8894f89e aa583e77
......@@ -238,6 +238,13 @@ class UpdateStudent(LoginRequiredMixin, FormView):
return reverse('detail_student',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(UpdateStudent, self).post(request, *args, **kwargs)
# welcome pages
class WelcomeName(LoginRequiredMixin, FormView):
template_name = 'welcome_name.html'
......@@ -264,7 +271,7 @@ class WelcomeName(LoginRequiredMixin, FormView):
'gender': me.gender, })
context['my_form'] = form
return context
def form_valid(self, form):
me = Student.objects.get(user=self.request.user)
......@@ -284,6 +291,11 @@ class WelcomeName(LoginRequiredMixin, FormView):
return reverse('welcomePrivacy',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeName, self).post(request, *args, **kwargs)
class WelcomePrivacy(LoginRequiredMixin, UpdateView):
model = Student
......@@ -315,6 +327,11 @@ class WelcomePrivacy(LoginRequiredMixin, UpdateView):
return reverse('welcomeMajor',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomePrivacy, self).post(request, *args, **kwargs)
class WelcomeMajor(LoginRequiredMixin, UpdateView):
model = Student
......@@ -346,6 +363,11 @@ class WelcomeMajor(LoginRequiredMixin, UpdateView):
return reverse('welcomeSocial',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeMajor, self).post(request, *args, **kwargs)
class WelcomeSocial(LoginRequiredMixin, DetailView):
model = Student
......@@ -378,6 +400,11 @@ class WelcomeSocial(LoginRequiredMixin, DetailView):
return reverse('detail_student',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(UpdateStudent, self).post(request, *args, **kwargs)
# majors pages
class ListMajors(LoginRequiredMixin, ListView):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment