Fix a couple of Edit Profile form message bugs

* Tweak message when one or more (but not all) security question answers
  have been changed so that it's clear that all are required
* Ensure success message gets shown upon saving

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-07-17 10:47:38 +12:00
parent 436596159f
commit 9cc87919ef
2 changed files with 2 additions and 2 deletions

View File

@ -249,7 +249,7 @@ class EditProfileForm(StyledModelForm):
if 'answer_1' not in self.changed_data \
or 'answer_2' not in self.changed_data \
or 'answer_3' not in self.changed_data:
raise forms.ValidationError("Please answer three security questions.")
raise forms.ValidationError("Please provide answers for all three security questions.")
security_question_1 = self.cleaned_data["security_question_1"]
security_question_2 = self.cleaned_data["security_question_2"]
security_question_3 = self.cleaned_data["security_question_3"]

View File

@ -933,7 +933,7 @@ class EditProfileFormView(SuccessMessageMixin, UpdateView):
view.send_activation_email(user)
return HttpResponseRedirect(reverse('reregister'))
return HttpResponseRedirect(self.get_success_url())
return super(EditProfileFormView, self).form_valid(form)
def get_success_message(self, cleaned_data):
return "Profile saved successfully"