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): ...@@ -238,6 +238,13 @@ class UpdateStudent(LoginRequiredMixin, FormView):
return reverse('detail_student', return reverse('detail_student',
kwargs={'slug':self.request.user.username}) 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 # welcome pages
class WelcomeName(LoginRequiredMixin, FormView): class WelcomeName(LoginRequiredMixin, FormView):
template_name = 'welcome_name.html' template_name = 'welcome_name.html'
...@@ -264,7 +271,7 @@ class WelcomeName(LoginRequiredMixin, FormView): ...@@ -264,7 +271,7 @@ class WelcomeName(LoginRequiredMixin, FormView):
'gender': me.gender, }) 'gender': me.gender, })
context['my_form'] = form context['my_form'] = form
return context return context
def form_valid(self, form): def form_valid(self, form):
me = Student.objects.get(user=self.request.user) me = Student.objects.get(user=self.request.user)
...@@ -284,6 +291,11 @@ class WelcomeName(LoginRequiredMixin, FormView): ...@@ -284,6 +291,11 @@ class WelcomeName(LoginRequiredMixin, FormView):
return reverse('welcomePrivacy', return reverse('welcomePrivacy',
kwargs={'slug':self.request.user.username}) 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): class WelcomePrivacy(LoginRequiredMixin, UpdateView):
model = Student model = Student
...@@ -315,6 +327,11 @@ class WelcomePrivacy(LoginRequiredMixin, UpdateView): ...@@ -315,6 +327,11 @@ class WelcomePrivacy(LoginRequiredMixin, UpdateView):
return reverse('welcomeMajor', return reverse('welcomeMajor',
kwargs={'slug':self.request.user.username}) 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): class WelcomeMajor(LoginRequiredMixin, UpdateView):
model = Student model = Student
...@@ -346,6 +363,11 @@ class WelcomeMajor(LoginRequiredMixin, UpdateView): ...@@ -346,6 +363,11 @@ class WelcomeMajor(LoginRequiredMixin, UpdateView):
return reverse('welcomeSocial', return reverse('welcomeSocial',
kwargs={'slug':self.request.user.username}) 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): class WelcomeSocial(LoginRequiredMixin, DetailView):
model = Student model = Student
...@@ -378,6 +400,11 @@ class WelcomeSocial(LoginRequiredMixin, DetailView): ...@@ -378,6 +400,11 @@ class WelcomeSocial(LoginRequiredMixin, DetailView):
return reverse('detail_student', return reverse('detail_student',
kwargs={'slug':self.request.user.username}) 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 # majors pages
class ListMajors(LoginRequiredMixin, ListView): 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