Catch invalid email address and show specific error message

This commit is contained in:
Alasdair Smith 2017-09-06 13:47:45 +01:00
parent 79566a9214
commit 320466a4f7
2 changed files with 7 additions and 2 deletions

View file

@ -147,6 +147,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
| #{translate("cannot_invite_non_user")}
span(ng-switch-when="cannot_invite_self")
| #{translate("cannot_invite_self")}
span(ng-switch-when="invalid_email")
| #{translate("invalid_email")}
span(ng-switch-default)
| #{translate("generic_something_went_wrong")}
button.btn.btn-default(

View file

@ -127,10 +127,13 @@ define [
# with new collaborator information.
addNextMember()
, 0
.catch () ->
.catch (err) ->
$scope.state.inflight = false
$scope.state.error = true
$scope.state.errorReason = null
if (err.status? and err.status == 400)
$scope.state.errorReason = 'invalid_email'
else
$scope.state.errorReason = null
$timeout addMembers, 50 # Give email list a chance to update