Commit 1facd2ed authored by David Haynes's avatar David Haynes 🙆

Ratethrottled appropriate classes with standard values

parent 227b6a4e
......@@ -241,6 +241,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/day', 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'
......@@ -269,7 +276,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)
......@@ -289,6 +296,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/day', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeName, self).post(request, *args, **kwargs)
class WelcomePrivacy(LoginRequiredMixin, UpdateView):
model = Student
......@@ -322,6 +334,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/day', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomePrivacy, self).post(request, *args, **kwargs)
class WelcomeMajor(LoginRequiredMixin, UpdateView):
model = Student
......@@ -355,6 +372,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/day', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeMajor, self).post(request, *args, **kwargs)
class WelcomeSocial(LoginRequiredMixin, DetailView):
model = Student
......@@ -389,6 +411,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/day', 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