Commit 83413b9e authored by Sean Hammond's avatar Sean Hammond Committed by Nick Stenning

Handle internal server errors in the registration form

This fixes #1755: no error is shown on the client side when an attempt
to register an account receives a 500 Server Error response.

The failure() method in AuthController gets called and tries to do
{errors, reason} = response.data, but this raises a TypeError because
response.data is undefined (because the response didn't have a valid
JSON body), so the client crashes as well.

The fix is to catch this exception on the client side, and show a
generic error to the user.
parent 5b861c1f
...@@ -18,7 +18,12 @@ class AuthController ...@@ -18,7 +18,12 @@ class AuthController
$scope.form?.$setPristine() $scope.form?.$setPristine()
failure = (form, response) -> failure = (form, response) ->
try
{errors, reason} = response.data {errors, reason} = response.data
catch
form.responseErrorMessage = "Oops, something went wrong on the server.
Please try again later!"
return
formRespond(form, errors, reason) formRespond(form, errors, reason)
this.submit = (form) -> this.submit = (form) ->
......
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